Поиск по блогу

21 мая 2011 г.

Android: Catch HOME button click event


Hi, I’m not good in English. This short article is for foreign persons (not from Russia), because they asked a lot.
This article in Russian: http://uas.name/android/android-catch-home-button-click-event-russian

Yes, there’s no way to programmable catch HOME-button click event. HOME-button-click event is not sent to applications by Android OS.

Only way I found is to read log (logcat) and parse results. When HOME activity is running – the next record appears in logcat:
Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/.Launcher }

U can parse this entry by regular expression. So, this is the best way I found to catch click on HOME.

How to read and open logcat? Read here

Комментариев нет:

Отправить комментарий