Is this the right way to compare Intents ? I never get into if / else, regardless of whether the incoming Intent is android.Intent.action.VIEW (intent.getAction () is returned):
private void handleIntent(Intent intent) { Log.d(TAG, intent.getAction()); // -> android.Intent.action.VIEW if (Intent.ACTION_VIEW.equals(intent.getAction())) { ShowToast.showToast(this, "Something..."); // Never get here } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); showResults(query); } }
Refresh . Why intent.getAction() return android.Intent.action.VIEW (capital 'i') while it should return android.Intent.action.VIEW , as in the spec ?
source share