List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:net.idlesoft.android.apps.github.activities.Commit.java
@Override protected void onRestoreInstanceState(final Bundle savedInstanceState) { try {/*from w w w . j av a 2 s. co m*/ if (savedInstanceState.containsKey("json")) { mJson = new JSONObject(savedInstanceState.getString("json")); } if (mJson != null) { buildUi(); } } catch (final JSONException e) { e.printStackTrace(); } super.onRestoreInstanceState(savedInstanceState); }
From source file:com.krayzk9s.imgurholo.ui.MessagingFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getArguments(); if (bundle != null && bundle.containsKey("data")) messageData = bundle.getParcelable("data"); setHasOptionsMenu(true);/*from www .j a v a2s . co m*/ }
From source file:com.mercandalli.android.apps.files.file.cloud.FileCloudFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); if (!args.containsKey(ARG_POSITION_IN_VIEW_PAGER)) { throw new IllegalStateException("Missing args. Please use newInstance()"); }/*from w w w . jav a 2s. co m*/ mFileManager = FileManager.getInstance(getContext()); mFileCloudFabManager = FileCloudFabManager.getInstance(); mPositionInViewPager = args.getInt(ARG_POSITION_IN_VIEW_PAGER); mFileCloudFabManager.addFabController(mPositionInViewPager, this); }
From source file:no.uka.findmyapp.android.rest.client.RestIntentService.java
@Override protected void onHandleIntent(Intent intent) { Log.v(debug, "Inside onHandleIntent"); Log.v(debug, "" + new Date() + ", In onHandleIntent for thread id = " + Thread.currentThread().getId()); Bundle bundle = intent.getExtras(); Log.v(debug, "onHandleIntent bundle recived"); ServiceModel serviceModel = (ServiceModel) bundle.get(IntentMessages.SERVICE_MODEL_PACKAGE); Credentials credentials = (Credentials) bundle.get(IntentMessages.CREDENTIALS_PACKAGE); createRestProcessor(credentials);//from ww w.j av a 2 s.c o m String userToken = ""; if (bundle.containsKey(IntentMessages.USER_TOKEN_PACKAGE)) { userToken = (String) bundle.get(IntentMessages.USER_TOKEN_PACKAGE); } Log.v(debug, "onHandleIntent: Sending " + serviceModel + " to the rest processor"); restProcessor.callRest(serviceModel, userToken); Log.v(debug, "" + new Date() + ", This thread is waked up."); }
From source file:org.thomnichols.android.gmarks.WebViewLoginActivity.java
protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); this.resumingTwoFactorAuth = savedInstanceState.getBoolean(KEY_PAUSED_FOR_TWO_FACTOR_AUTH, false); if (this.resumingTwoFactorAuth && savedInstanceState.containsKey(KEY_PAUSED_AT_URL)) this.resumeAtURL = savedInstanceState.getString(KEY_PAUSED_AT_URL); }
From source file:ch.gianulli.trelloapi.TrelloAPI.java
/** * @param context Current context (e.g. activity) * @throws IllegalArgumentException if the application key and secret are not in a {@code * <meta-data>} tag inside the {@code <application>} tag in * the app's manifest. *//*from w w w . j a va 2 s. co m*/ public TrelloAPI(Context context) { mContext = context; mPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); mRequestQueue = Volley.newRequestQueue(context); // Get application key from <meta-data> tag in manifest try { ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; if (!bundle.containsKey(META_DATA_APP_KEY)) { throw new IllegalArgumentException( "Application key could not be found. Have you" + " put it in your application manifest?"); } if (!bundle.containsKey(META_DATA_APP_SECRET)) { throw new IllegalArgumentException("Application secret could not be found. Have " + "you put it in your application manifest?"); } mAppKey = bundle.getString(META_DATA_APP_KEY); mAppSecret = bundle.getString(META_DATA_APP_SECRET); } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException("Application key and secret could not be found. " + "Have you put them in your application manifest?"); } }
From source file:li.barter.fragments.LoginFragment.java
/** * If an onward intent has been specified, provides that. * <p/>//ww w . j a v a 2s .com * Otherwise, just creates a default intent to open the user's profile */ private Intent getDefaultOnwardIntent() { final Bundle extras = getArguments(); if (extras != null && extras.containsKey(Keys.ONWARD_INTENT)) { return extras.getParcelable(Keys.ONWARD_INTENT); } else { return null; } }
From source file:app.hacked.ProjectListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Restore the previously serialized activated item position. if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); }/*w ww. j ava2s.com*/ if (getActivity().findViewById(R.id.ProjectDetails) != null && savedInstanceState == null) { ProjectWelcomeFragment fragment = new ProjectWelcomeFragment(); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment) .commit(); } progressBar = view.findViewById(R.id.progressBar); if (savedInstanceState != null) progressBar.setVisibility(View.GONE); }
From source file:com.eleybourn.bookcatalogue.goodreads.api.ListReviewsApiHandler.java
void date2Sql(Bundle b, String key) { if (b.containsKey(key)) { String date = b.getString(key); try {// w w w. ja v a 2 s . c o m Date d = mUpdateDateFmt.parse(date); date = Utils.toSqlDateTime(d); b.putString(key, date); } catch (Exception e) { b.remove(key); } } }
From source file:net.idlesoft.android.apps.github.activities.SingleIssue.java
@Override public void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState.containsKey("commentText")) { ((EditText) mCommentArea.findViewById(R.id.et_issue_comment_area_body)) .setText(savedInstanceState.getString("commentText")); }/*from w w w. ja va 2 s .c o m*/ try { if (savedInstanceState.containsKey("commentsJson")) { mCommentsJson = new JSONArray(savedInstanceState.getString("commentsJson")); } else { return; } } catch (final Exception e) { e.printStackTrace(); return; } if (mCommentsJson != null) { mAdapter.loadData(mCommentsJson); mAdapter.pushData(); } }