获取手机状态:
import android.content.Context;
import android.telephony.TelephonyManager;
//获得相应的系统服务
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
/**...
分类:
移动开发 时间:
2015-01-28 16:01:33
阅读次数:
217
AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE) ;
????????sound = (SeekBar) findViewById(R.id.sb_sound);
????????/**
* 注册...
分类:
其他好文 时间:
2015-01-27 16:36:21
阅读次数:
176
1、得到系统的振动器Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);2、设置振动时间vibrator.vibrate(500);// vibrator.vibrate(1000); // long[] pattern...
分类:
其他好文 时间:
2015-01-23 06:06:18
阅读次数:
112
在类中使用getSystemService的时候需要这样进行使用:1.public class JajaMenu extends Activity { public static JajaMenu instance; @Override public void onCrea...
分类:
移动开发 时间:
2015-01-19 15:40:05
阅读次数:
221
1:全部布局自定义
LayoutInflater addBlackNumberInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View view = addBlackNumberInflater.inflate(R.layout.ale...
分类:
其他好文 时间:
2015-01-15 16:05:17
阅读次数:
165
Java代码/***获取android当前可用内存大小*/privateStringgetAvailMemory(){//获取android当前可用内存大小ActivityManageram=(ActivityManager)getSystemService(Context.ACTIVITY_SER...
分类:
移动开发 时间:
2015-01-15 09:19:32
阅读次数:
221
设备振动器,可以设置震动的频率,模拟心跳的震动。
获取设备振动器有两种方法:
vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator = (Vibrator) getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);
开...
分类:
其他好文 时间:
2015-01-13 19:55:05
阅读次数:
295
Android系统为传感器支持强大的管理服务,开发传感器应用的步骤如下:
(1)调用Context的 getSystemService(Context.SENSOR_SERVICE)方法获取Sensor Manager对象,SensorManager对象代表系统的传感器管理服务。
(2)调用SensorManager的getDefaultSensor(int type)方法来获取制定类型的传感...
分类:
其他好文 时间:
2015-01-13 14:23:54
阅读次数:
184
Android里判断是否可以上网,常用的是如下方法:
/**
* 检测网络是否连接
*
* @return
*/
private boolean isNetworkAvailable() {
// 得到网络连接信息
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context...
分类:
移动开发 时间:
2015-01-12 21:05:03
阅读次数:
229
前一篇百度地图开发讲述"(二).定位城市位置和城市POI搜索",主要通过监听对象MKSearchListener类实现城市兴趣点POI(Point of Interest)搜索。该篇讲述定位当前自己的位置及使用getLastKnownLocation获取location总时为空值的问题。其基本步骤如下: 1.先实例LocationManager,getSystemService(Context.LOCATION_SERVICE)再确定获取系统的定位服务;2.选择位置提供器...最后提出问题及解决方法包括源码...
分类:
移动开发 时间:
2015-01-11 06:15:01
阅读次数:
468