Log.d() send a DEBUG log message
log.e() send a ERROR
log.i() send an INFO
log.v() send a VERBOSE
log.w() send a WARN
$ echo "Hello world" > hello 在当前目录创建一个文本文件hello 内容为Hello world 且覆盖该文本的所有内容 推荐文本首次创建时使用
$ echo "My test" >>hello 在hello文本中添加字符串
获得Arrays中的字符数组String[] arraysMethod = mActivity.getResources().getStringArray(
R.array.Input_method);
Button强制获取焦点
public void onClick(View v) {
if (!v.isFocused()) {
v.requestFocus();
}
handle_saveconf(mToggleAutoState);
}
Handler使用
延迟方法执行
mMainHandler.postDelayed(new Runnable() {
public void run() {
setApps(apps, true, false);
}
}, 0);
mHandler.removeCallbacksAndMessages(null);
mHandler.postDelayed(new Runnable() {
public void run() {
notifyValueChange(child, oldVal, newVal);
}
}, mNotifyDelay);
使用工作线程中,looper
开一个工作Handler线程供其他Handler使用
public static HandlerThread sTaskRunner = new HandlerThread(
"Setting_Task_Runner");
static {
sTaskRunner.start();
}
private Handler mTaskHandler = new Handler(App.sTaskRunner.getLooper()) {
public void handleMessage(Message msg) {
switch (msg.what) {
case GET_WALLPAPER:
getWallpaper();
return;
case CHANGE_WALLPAPER:
changeWallpaper(msg.arg1);
return;
}
}
};
按钮获得焦点
mIpSaveBtn.setEnabled(state);
mIpSaveBtn.setFocusable(state);
mIpSaveBtn.setFocusableInTouchMode(state);
获取组件必须要抛的异常
if (mAppIcon == null || mAppSize == null || mAppName == null 65
|| mAppVersion == null || mAppTotalSize == null 66
|| mAppDataSize == null || mAppCacheSize == null 67
|| mForceStop == null || mUninstall == null || mClear == null 68
|| mMoveApp == null | mProgressBar == null) { 69
throw new InflateException("Do you miss ga child?"); 70
}
颜色
17
18 <resources> <resources> 18
19 19
<color name="gray">#88888888</color> 20
20 <color name="white">#ffffffff</color> <color name="white">#ffffffff</color> 21
21 <color name="black">#ff000000</color> <color name="black">#ff000000</color> 22
22 <color name="translucent">#38383838</color> <color name="translucent">#38383838</color> 23
23 <color name="transparent">#00000000</color> <color name="transparent">#00000000</color> 24
<drawable name="gray">#88888888</drawable> 25
<drawable name="white">#ffffffff</drawable> 26
24 27
25 </resources> </resources>
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case SHOW_MENU:
showMainMenu(true);
break;
case HIDE_MENU:
showMainMenu(false);
break;
}
}
};
private void showMainMenu(boolean show) {
if (show) {
mHandler.removeMessages(HIDE_MENU);
mHandler.sendEmptyMessageDelayed(HIDE_MENU, DELAYED_TIME);
} else {
finish();
}
}
onvaluechange接口中调用getcurrentvalue 没必要直接获取newval 0 ,1 pointItem中出现的问题 是由调用getcrrentvalue在回掉之后发生造成的
refreshDrawableState();
log.e() send a ERROR
log.i() send an INFO
log.v() send a VERBOSE
log.w() send a WARN
$ echo "Hello world" > hello 在当前目录创建一个文本文件hello 内容为Hello world 且覆盖该文本的所有内容 推荐文本首次创建时使用
$ echo "My test" >>hello 在hello文本中添加字符串
获得Arrays中的字符数组String[] arraysMethod = mActivity.getResources().getStringArray(
R.array.Input_method);
Button强制获取焦点
public void onClick(View v) {
if (!v.isFocused()) {
v.requestFocus();
}
handle_saveconf(mToggleAutoState);
}
Handler使用
延迟方法执行
mMainHandler.postDelayed(new Runnable() {
public void run() {
setApps(apps, true, false);
}
}, 0);
mHandler.removeCallbacksAndMessages(null);
mHandler.postDelayed(new Runnable() {
public void run() {
notifyValueChange(child, oldVal, newVal);
}
}, mNotifyDelay);
使用工作线程中,looper
开一个工作Handler线程供其他Handler使用
public static HandlerThread sTaskRunner = new HandlerThread(
"Setting_Task_Runner");
static {
sTaskRunner.start();
}
private Handler mTaskHandler = new Handler(App.sTaskRunner.getLooper()) {
public void handleMessage(Message msg) {
switch (msg.what) {
case GET_WALLPAPER:
getWallpaper();
return;
case CHANGE_WALLPAPER:
changeWallpaper(msg.arg1);
return;
}
}
};
按钮获得焦点
mIpSaveBtn.setEnabled(state);
mIpSaveBtn.setFocusable(state);
mIpSaveBtn.setFocusableInTouchMode(state);
获取组件必须要抛的异常
if (mAppIcon == null || mAppSize == null || mAppName == null 65
|| mAppVersion == null || mAppTotalSize == null 66
|| mAppDataSize == null || mAppCacheSize == null 67
|| mForceStop == null || mUninstall == null || mClear == null 68
|| mMoveApp == null | mProgressBar == null) { 69
throw new InflateException("Do you miss ga child?"); 70
}
颜色
17
18 <resources> <resources> 18
19 19
<color name="gray">#88888888</color> 20
20 <color name="white">#ffffffff</color> <color name="white">#ffffffff</color> 21
21 <color name="black">#ff000000</color> <color name="black">#ff000000</color> 22
22 <color name="translucent">#38383838</color> <color name="translucent">#38383838</color> 23
23 <color name="transparent">#00000000</color> <color name="transparent">#00000000</color> 24
<drawable name="gray">#88888888</drawable> 25
<drawable name="white">#ffffffff</drawable> 26
24 27
25 </resources> </resources>
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case SHOW_MENU:
showMainMenu(true);
break;
case HIDE_MENU:
showMainMenu(false);
break;
}
}
};
private void showMainMenu(boolean show) {
if (show) {
mHandler.removeMessages(HIDE_MENU);
mHandler.sendEmptyMessageDelayed(HIDE_MENU, DELAYED_TIME);
} else {
finish();
}
}
onvaluechange接口中调用getcurrentvalue 没必要直接获取newval 0 ,1 pointItem中出现的问题 是由调用getcrrentvalue在回掉之后发生造成的
refreshDrawableState();