| 생김새 | 코드 | 의미 |
|---|---|---|
| " | " | 따옴표 |
| & | & | 앰퍼샌드 |
| < | < | 꺽쇠 |
| > | > | 꺽쇠 |
| © | © | 카피라이트 |
| ® | ® | 등록상표 |
| ™ | ™ | 트레이드마크 |
| × | × | 곱하기 기호 |
| ÷ | ÷ | 나눗셈 기호 |
| • | • | 불릿 |
| · | · | 가운데 점 |
| ⋅ | ⋅ | dot operator |
| — | — or — | dash |
2013년 4월 29일 월요일
어플 실행 여부 확인
public static boolean isRunningProcess(Context context, String packageName){ boolean isRunning = false; // ActivityManager actMng = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); // List<RunningAppProcessInfo> proceses = actMng.getRunningAppProcesses(); // for(RunningAppProcessInfo rap : proceses){ // if( rap.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND && rap.processName.equals(packageName)){ // isRunning = true; // break; // } // } ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); List<RunningTaskInfo> info; info = activityManager.getRunningTasks(1); for (Iterator iterator = info.iterator(); iterator.hasNext();) { RunningTaskInfo runningTaskInfo = (RunningTaskInfo) iterator.next(); if(runningTaskInfo.topActivity.getClassName().startsWith(packageName) ) { return true; } } return isRunning; }
2013년 4월 24일 수요일
사용자가 5초 동안 앱을 터치하지 않았을 경우 처리
public class hard_UserInteraction extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hard_userinteraction);
}
protected Handler mFinishHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
finish();
}
};
void registerFinish() {
mFinishHandler.sendEmptyMessageDelayed(0, 5 * 1000);
}
void unRegisterFinish() {
}
void RefreshFinish() {
unRegisterFinish();
registerFinish();
}
protected void onResume() {
super.onResume();
registerFinish();
}
protected void onPause() {
super.onPause();
unRegisterFinish();
}
public void onUserInteraction() {
super.onUserInteraction();
RefreshFinish();
}
protected void onUserLeaveHint () {
super.onUserLeaveHint();
Toast.makeText(this, "Leave by user", Toast.LENGTH_LONG).show();
}
}
출처 : http://www.winapi.co.kr/android/annex/19-3.htm
피드 구독하기:
덧글 (Atom)