List of usage examples for android.content Intent hasExtra
public boolean hasExtra(String name)
From source file:com.lamcreations.scaffold.common.activities.BaseActivity.java
protected Bundle getArguments() { Bundle args = new Bundle(); Intent intent = getIntent(); if (intent.hasExtra(ScaffoldConstants.ARGS)) { args.putAll(intent.getBundleExtra(ScaffoldConstants.ARGS)); }/* www .ja v a2 s. c om*/ return args; }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.NotitieActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set the title in the toolbar Intent intent = getIntent(); if ((intent != null) && (intent .hasExtra(MakkelijkeMarktProvider.mTableNotitie + MakkelijkeMarktProvider.Notitie.COL_ID))) { setToolbarTitle(getString(R.string.notitie_edit)); } else {//from w ww . ja va 2 s . c o m setToolbarTitle(getString(R.string.notitie_add)); } // get selected markt naam from sharedpreferences and set the subtitle in the toolbar SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); String marktNaam = settings.getString(getString(R.string.sharedpreferences_key_markt_naam), ""); setToolbarSubtitle(marktNaam); // create new or get existing instance of notitiefragment if (savedInstanceState == null) { mNotitieFragment = new NotitieFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.container, mNotitieFragment, NOTITIE_FRAGMENT_TAG); transaction.commit(); } else { mNotitieFragment = (NotitieFragment) getSupportFragmentManager() .findFragmentByTag(NOTITIE_FRAGMENT_TAG); } // set the active drawer menu option if (mDrawerFragment.isAdded()) { mDrawerFragment.checkItem(mDrawerFragment.DRAWER_POSITION_NOTITIES); } // replace the drawer hamburger with the back-arrow if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(false); mDrawerToggle.setDrawerIndicatorEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
From source file:com.example.popularmovies.MovieDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_detail); mContext = getApplicationContext();//from ww w . j av a 2 s. c o m Intent receivedIntent = getIntent(); if (receivedIntent == null || !receivedIntent.hasExtra(Intent.EXTRA_STREAM)) { showError(); } mMovieSelected = (Movie) receivedIntent.getParcelableExtra(Intent.EXTRA_STREAM); if (mMovieSelected == null) { showError(); } TMDBUtils.fetchImage(mContext, ((ImageView) findViewById(R.id.iv_movie_backdrop)), mMovieSelected.getPosterPath(), TMDBUtils.IMAGE_SIZE.w780); ((TextView) findViewById(R.id.tv_movie_title)).setText(mMovieSelected.getTitle()); ((TextView) findViewById(R.id.tv_movie_release_date)).setText(mMovieSelected.getReleaseDate()); ((TextView) findViewById(R.id.tv_movie_vote_average)) .setText(Double.toString(mMovieSelected.getVoteAverage())); ((TextView) findViewById(R.id.tv_movie_plot_synopsis)).setText(mMovieSelected.getOverview()); }
From source file:com.lillicoder.newsblurry.stories.StoriesActivity.java
/** * Gets the {@link Feed} contained in the given {@link Intent} under the * {@link #INTENT_FEED_TO_DISPLAY} key.//from ww w .jav a 2 s . co m * @param intent {@link Intent} to get the feed from. * @return {@link Feed} contained in the given intent, * <code>null</code> if there was no feed found. */ private Feed getFeedFromIntent(Intent intent) { Feed feed = null; if (intent != null && intent.hasExtra(INTENT_FEED_TO_DISPLAY)) feed = (Feed) intent.getSerializableExtra(INTENT_FEED_TO_DISPLAY); return feed; }
From source file:com.facebook.share.DeviceShareDialog.java
@Override protected void registerCallbackImpl(final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { @Override/* w ww . j a v a 2 s .c o m*/ public boolean onActivityResult(int resultCode, Intent data) { if (data.hasExtra("error")) { FacebookRequestError error = data.getParcelableExtra("error"); callback.onError(error.getException()); return true; } callback.onSuccess(new Result()); return true; } }); }
From source file:com.eugene.fithealthmaingit.UI.UserInformationActivity.java
/** * Get the Results from the Other Activities * * @param requestCode In this case either 1 = ACTIVITY_ONE_REQUEST or 2 = ACTIVITY_TWO_REQUEST * @param resultCode Determines whether the request was successful. * @param data The being sent from other activities via Intent *///from w w w .j a va 2s.c o m @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ACTIVITY_ONE_REQUEST && resultCode == RESULT_OK) { if (data.hasExtra(ACTIVITY_ONE_RESULT)) { String result = data.getExtras().getString(ACTIVITY_ONE_RESULT); CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox); if (result.equals("CONNECTED")) { checkBox.setChecked(true); } else { checkBox.setChecked(false); } } } }
From source file:com.zhi.android.modules.splash.SplashActivity.java
@Override @SuppressWarnings({ "CheckReturnValue", "unchecked" }) protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTimerObservable = Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); mTimerObservable.subscribe(aLong -> { mTimerObservable = null;/*from w ww. j a v a 2 s .c o m*/ final Intent intent = getIntent(); final Intent nextIntent; if (intent != null && intent.hasExtra(BuildConfig.NEXT_INTENT)) { nextIntent = intent.getParcelableExtra(BuildConfig.NEXT_INTENT); } else { nextIntent = new Intent(Intent.ACTION_MAIN); } nextIntent.addCategory(Intent.CATEGORY_DEFAULT); ActivityCompat.startActivity(SplashActivity.this, nextIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(SplashActivity.this).toBundle()); supportFinishAfterTransition(); }); }
From source file:ar.com.martineo14.spotifystreamer.ArtistDetailActivityFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_artist_detail, container, false); Intent intent = getActivity().getIntent(); if (intent != null && intent.hasExtra(ARTIST_ID)) { mArtistIDStr = intent.getStringExtra(ARTIST_ID); listView = (ListView) rootView.findViewById(R.id.list_artist_top_ten); ArtistTopTenTask artistTopTenTask = new ArtistTopTenTask(); artistTopTenTask.execute(mArtistIDStr); }/* w w w . j ava2 s . c o m*/ return rootView; }
From source file:com.google.android.gms.samples.wallet.CheckoutActivity.java
/** * If the confirmation page encounters an error it can't handle, it will send the customer back * to this page. The intent should include the error code as an {@code int} in the field * {@link WalletConstants#EXTRA_ERROR_CODE}. *///from www . j ava 2 s .com @Override protected void onNewIntent(Intent intent) { if (intent.hasExtra(WalletConstants.EXTRA_ERROR_CODE)) { int errorCode = intent.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, 0); handleError(errorCode); } }
From source file:com.lambdasoup.quickfit.persist.FitApiFailureResolutionService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (!intent.hasExtra(EXTRA_FAILURE_RESULT)) { throw new IllegalArgumentException("Required extra " + EXTRA_FAILURE_RESULT + " missing."); }//from w w w. j a v a2 s .c om ConnectionResult connectionResult = intent.getParcelableExtra(EXTRA_FAILURE_RESULT); if (isBound && currentForegroundResolver != null) { handleErrorInForeground(connectionResult, startId); } else { handleErrorInBackground(connectionResult, startId); } return START_REDELIVER_INTENT; }