How to check if the home button was released or even the home activity cames out ?

Discussion in 'Android Hacks and Help' started by asteroidg, Jan 13, 2011.

  1. asteroidg
    Offline

    asteroidg New Member

    Joined:
    Jan 8, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    How to check if the home button was released or even the home activity came out ?

    Hi to every one.

    How can I check inside the OnRestart method, if the home button was released ?

    or

    When the home button is released then the following intent is called { act=android.intent.action.MAIN ...}. How to check inside the method onRestart that the above Intent was called ?

    Thank you in advance.
     
    Last edited: Jan 13, 2011
  2. asteroidg
    Offline

    asteroidg New Member

    Joined:
    Jan 8, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    I tried the following code:
    ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);

    List<ActivityManager.RunningAppProcessInfo> rs = am.getRunningAppProcesses();

    for (int i=0; i<rs.size(); i++)
    {
    ActivityManager.RunningAppProcessInfo rsi = rs.get(i);
    Log.i("ProcessLog", "Process PID=" + rsi.pid+"-"+rsi.processName);

    }

    The PID is the one that I need but the process always show me System, if it was a way to get from PID the following :
    ActivityManager(81): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/.Launcher }
    then that could solve my request about to know when Home activity came out ...
     
  3. asteroidg
    Offline

    asteroidg New Member

    Joined:
    Jan 8, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    Any ideas ?
     
Search tags for this page

android activitymanager home key

,
how to detect home button android
,

how to know home button is clicked in android