1. You want that $100.00 in your pocket or an Amazon Fire TV don't you? Well here's the deal. With our new updated look we are in desperate need of an updated logo. The 'old' one has certainly served us well, but it's time. Find all the details here: bit.ly/1q0k6Wa
  2. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

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:
    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:
    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:
    0
    Any ideas ?
Search tags for this page
how to detect home button android
,

how to know home button is clicked in android