android Programming Glossary: intentaction
Android Activity Stack is not working as stated in the docs - last activity in task stack not shown http://stackoverflow.com/questions/11006539/android-activity-stack-is-not-working-as-stated-in-the-docs-last-activity-in-t if isTaskRoot final Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER.. if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main.. Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 public void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction.. intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return event KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT..
How to prevent multiple instances of an activity when it is launched with different intents http://stackoverflow.com/questions/4341600/how-to-prevent-multiple-instances-of-an-activity-when-it-is-launched-with-differ if isTaskRoot final Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER.. if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main.. Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not..
Android - registering a headset button click with BroadcastReceiver http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver public void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction.. intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return KeyEvent event KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT..
Android Activity Stack is not working as stated in the docs - last activity in task stack not shown http://stackoverflow.com/questions/11006539/android-activity-stack-is-not-working-as-stated-in-the-docs-last-activity-in-t is to place this in the onCreate method of your main Activity if isTaskRoot final Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN.. Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not the root. Finishing Main Activity instead.. getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not the root. Finishing Main Activity instead of launching. finish..
MediaButtonIntentReceiver not working in Android 4.0+ http://stackoverflow.com/questions/13257982/mediabuttonintentreceiver-not-working-in-android-4-0 event public MediaButtonIntentReceiver super @Override public void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return event KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT.. void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return event KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT if event null return try int action event.getAction..
How to prevent multiple instances of an activity when it is launched with different intents http://stackoverflow.com/questions/4341600/how-to-prevent-multiple-instances-of-an-activity-when-it-is-launched-with-differ Instead we check if we are the root and if not we finish. if isTaskRoot final Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN.. Intent intent getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not the root. Finishing Main Activity instead.. getIntent final String intentAction intent.getAction if intent.hasCategory Intent.CATEGORY_LAUNCHER intentAction null intentAction.equals Intent.ACTION_MAIN Log.w LOG_TAG Main Activity is not the root. Finishing Main Activity instead of launching. finish..
Android - registering a headset button click with BroadcastReceiver http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver public MediaButtonIntentReceiver super @Override public void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return KeyEvent event KeyEvent intent.getParcelableExtra.. void onReceive Context context Intent intent String intentAction intent.getAction if Intent.ACTION_MEDIA_BUTTON.equals intentAction return KeyEvent event KeyEvent intent.getParcelableExtra Intent.EXTRA_KEY_EVENT if event null return int action event.getAction..
|