List of usage examples for android.content Intent hasExtra
public boolean hasExtra(String name)
From source file:mobisocial.socialkit.musubi.Musubi.java
public static boolean isMusubiIntent(Intent intent) { return intent.hasExtra(EXTRA_FEED_URI) || intent.hasExtra(EXTRA_OBJ_URI); }
From source file:net.openid.appauth.AuthorizationResponse.java
/** * Extracts an authorization response from an intent produced by {@link #toIntent()}. This is * used to extract the response from the intent data passed to an activity registered as the * handler for {@link AuthorizationService#performAuthorizationRequest}. *//*from ww w . ja v a2 s . com*/ @Nullable public static AuthorizationResponse fromIntent(@NonNull Intent dataIntent) { checkNotNull(dataIntent, "dataIntent must not be null"); if (!dataIntent.hasExtra(EXTRA_RESPONSE)) { return null; } try { return AuthorizationResponse.jsonDeserialize(dataIntent.getStringExtra(EXTRA_RESPONSE)); } catch (JSONException ex) { throw new IllegalArgumentException("Intent contains malformed auth response", ex); } }
From source file:net.openid.appauth.AuthorizationException.java
/** * Extracts an {@link AuthorizationException} from an intent produced by {@link #toIntent()}. * This is used to retrieve an error response in the handler registered for a call to * {@link AuthorizationService#performAuthorizationRequest}. *//*from w ww.j av a 2s . c om*/ @Nullable public static AuthorizationException fromIntent(Intent data) { checkNotNull(data); if (!data.hasExtra(EXTRA_EXCEPTION)) { return null; } try { return fromJson(data.getStringExtra(EXTRA_EXCEPTION)); } catch (JSONException ex) { throw new IllegalArgumentException("Intent contains malformed exception data", ex); } }
From source file:com.irccloud.android.NotificationDismissBroadcastReceiver.java
@Override public void onReceive(Context ctx, Intent i) { if (i.hasExtra("eids")) { int bid = i.getIntExtra("bid", -1); long[] eids = i.getLongArrayExtra("eids"); for (int j = 0; j < eids.length; j++) { if (eids[j] > 0) { Crashlytics.log(Log.INFO, "IRCCloud", "Dismiss bid" + bid + " eid" + eids[j]); NotificationsList.getInstance().dismiss(bid, eids[j]); NotificationManagerCompat.from(IRCCloudApplication.getInstance().getApplicationContext()) .cancel((int) (eids[j] / 1000)); }/*w ww. ja v a2 s . co m*/ } Crashlytics.log(Log.INFO, "IRCCloud", "Cancel bid" + bid); NotificationManagerCompat.from(IRCCloudApplication.getInstance().getApplicationContext()).cancel(bid); } IRCCloudApplication.getInstance().getApplicationContext() .sendBroadcast(new Intent(DashClock.REFRESH_INTENT)); }
From source file:com.conferenceengineer.android.iosched.ui.TaskStackBuilderProxyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TaskStackBuilder builder = TaskStackBuilder.create(this); Intent proxyIntent = getIntent(); if (!proxyIntent.hasExtra(EXTRA_INTENTS)) { finish();//from w w w. jav a2s . c o m return; } for (Parcelable parcelable : proxyIntent.getParcelableArrayExtra(EXTRA_INTENTS)) { builder.addNextIntent((Intent) parcelable); } builder.startActivities(); finish(); }
From source file:com.twolinessoftware.smarterlist.activity.ShoppingNavigationActivity.java
private void updateView(Intent intent) { if (intent == null || !intent.hasExtra(EXTRA_SMART_LIST)) { Ln.e("Missing SmartList Id"); finish();/* w w w . ja va 2s . c om*/ } m_smartList = intent.getParcelableExtra(EXTRA_SMART_LIST); setTitle(m_smartList.getName()); showFragment(SmartItemListViewRecyclerViewFragment.newInstance(m_smartList, SmartListItemRecyclerViewAdapter.SelectionMode.Check)); }
From source file:com.lillicoder.newsblurry.stories.StoryFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Intent intent = this.getActivity().getIntent(); if (intent != null && intent.hasExtra(StoryActivity.INTENT_STORY_TO_DISPLAY)) { Story story = (Story) intent.getSerializableExtra(StoryActivity.INTENT_STORY_TO_DISPLAY); this.displayStory(story); }/* w w w. j a v a 2 s. c o m*/ }
From source file:com.granita.tasks.homescreen.TaskListWidgetSettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_widget_configuration); Intent intent = getIntent(); if (intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { mAppWidgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); // make the result intent and set the result to canceled mResultIntent = new Intent(); mResultIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); setResult(RESULT_CANCELED, mResultIntent); }//w w w.j a va 2 s . c o m TaskListSelectionFragment fragment = new TaskListSelectionFragment(this); //fragment.setMListener(this); getSupportFragmentManager().beginTransaction().add(R.id.task_list_selection_container, fragment).commit(); }
From source file:com.nexmo.sdk.sample.verifysample_pushenabled.SampleApplication.java
/** * Acquire a new verify client.//from w w w . j a v a2s .c om * If the user changes the settings shared preferences, a new verify client needs * to be created to reflect the new configuration. * Storing the credentials: applicationId and sharedSecretKey is up to the developer: * you may choose to use SharedPreferences, a file or define meta-data in the AndroidManifest.xml */ public void acquireVerifyClient() { if (TextUtils.isEmpty(Config.NexmoAppId) || TextUtils.isEmpty(Config.NexmoSharedSecretKey)) { Log.e(TAG, "You must supply valid appId and sharedSecretKey, provided by Nexmo"); return; } // Acquire the NexmoClient with all the necessary parameters. Context context = getApplicationContext(); try { this.nexmoClient = new NexmoClient.NexmoClientBuilder().context(context) .applicationId(Config.NexmoAppId).sharedSecretKey(Config.NexmoSharedSecretKey).build(); } catch (ClientBuilderException e) { e.printStackTrace(); return; } this.verifyClient = new VerifyClient(nexmoClient); if (TextUtils.isEmpty(Config.PushSenderID)) Log.e(TAG, "You haven't provided a valid SENDER_ID for GCM to be enabled."); else { mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.hasExtra(GcmRegistrationIntentService.INTENT_EXTRA_PUSH_TOKEN)) nexmoClient.setGcmRegistrationToken( intent.getStringExtra(GcmRegistrationIntentService.INTENT_EXTRA_PUSH_TOKEN)); } }; LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver, new IntentFilter(GcmRegistrationIntentService.REGISTRATION_COMPLETE)); } }
From source file:com.lillicoder.newsblurry.feeds.FeedsActivity.java
/** * Gets the {@link IFeed} contained in the given {@link Intent} under the * {@link #INTENT_FEED_TO_DISPLAY} key.//from w w w . ja v a2 s . c om * @param intent {@link Intent} to get the feed from. * @return {@link IFeed} contained in the given intent, * <code>null</code> if there was no feed found. */ private IFeed getFeedFromIntent(Intent intent) { IFeed feed = null; if (intent != null && intent.hasExtra(INTENT_FEED_TO_DISPLAY)) feed = (IFeed) intent.getSerializableExtra(INTENT_FEED_TO_DISPLAY); return feed; }