List of usage examples for android.os Bundle containsKey
public boolean containsKey(String key)
From source file:com.idean.atthack.api.Param.java
/** * Add param value from Bundle to JsonObject * //from ww w . ja va 2 s .c o m * @param obj * @param params */ public void addToJson(JSONObject obj, Bundle params) { if (params.containsKey(name())) { try { switch (type) { case BOOLEAN: obj.put(name(), params.getBoolean(name())); break; case FLOAT: obj.put(name(), params.getFloat(name())); break; case INTEGER: obj.put(name(), params.getInt(name())); break; case STRING: obj.put(name(), params.getString(name())); break; default: } } catch (JSONException e) { Log.w(TAG, "Unable to add param " + this + " to json"); } } }
From source file:cat.ppicas.cleanarch.ui.fragment.CityDetailFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args == null || !args.containsKey(ARG_CITY_ID)) { throw new IllegalArgumentException("Invalid Fragment arguments"); }/*from w ww . j a va 2 s . co m*/ mCityId = args.getString(ARG_CITY_ID); mPresenter = ((PresenterHolder) getActivity()).getOrCreatePresenter(this); }
From source file:com.chess.genesis.activity.GameListFrag.java
protected void loadGame(final Bundle gamedata) { if (isTablet) { final boolean isOnline = gamedata.containsKey("gameid"); final int gametype = Integer.parseInt(gamedata.getString("gametype")); final MenuBarFrag gameMenu = new MenuBarFrag(); final BoardNavFrag gameNav = new BoardNavFrag(); final GameFrag gameFrag = (gametype == Enums.GENESIS_CHESS) ? new GenGameFrag() : new RegGameFrag(); gameFrag.setArguments(gamedata); gameFrag.setMenuBarFrag(gameMenu); // Pop game if already loaded fragMan.popBackStack(gameFrag.getBTag(), FragmentManager.POP_BACK_STACK_INCLUSIVE); FragmentTransaction ftrans = fragMan.beginTransaction() .replace(R.id.topbar02, gameMenu, gameMenu.getBTag()) .replace(R.id.botbar02, gameNav, gameNav.getBTag()) .replace(R.id.panel02, gameFrag, gameFrag.getBTag()); // setup chat window if (isOnline) { final MenuBarFrag msgMenu = new MenuBarFrag(); final BaseContentFrag msgFrag = new MsgBoxFrag(); msgFrag.setArguments(gamedata); msgFrag.setMenuBarFrag(msgMenu); ftrans = ftrans.replace(R.id.topbar03, msgMenu, msgMenu.getBTag()).replace(R.id.panel03, msgFrag, msgFrag.getBTag());/*w w w. j a va 2s. com*/ } ftrans.addToBackStack(gameFrag.getBTag()).commit(); } else { final Intent intent = new Intent(act, Game.class); intent.putExtras(gamedata); startActivity(intent); } }
From source file:com.acomminos.morlunk.MorlunkHomeActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { getSupportActionBar()//w ww . j a v a2 s . c o m .setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); } }
From source file:net.reichholf.dreamdroid.loader.AsyncByteLoader.java
@SuppressWarnings("unchecked") private void init(Context context, Bundle args) { DreamDroid.loadCurrentProfile(context); mShc = new SimpleHttpClient(); if (args != null && args.containsKey("params")) mParams = (ArrayList<NameValuePair>) args.getSerializable("params"); else//from w ww . j a va2 s. co m mParams = null; mUri = args.getString("uri"); }
From source file:com.richtodd.android.quiltdesign.app.OpenRepositoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_repository); Intent intent = getIntent();//from w w w .java 2s .c om Bundle extras = intent.getExtras(); if (extras.containsKey(Intent.EXTRA_STREAM)) { Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); try { JSONObject jsonObject = JSONUtility.loadJSONObject(getContentResolver(), uri); m_repository = new JSONRepository(jsonObject, new QuiltDesignThumbnailProvider()); } catch (RepositoryException e) { Handle.asRuntimeError(e); } } m_text_theme_count = (TextView) findViewById(R.id.text_theme_count); m_text_block_count = (TextView) findViewById(R.id.text_block_count); m_text_quilt_count = (TextView) findViewById(R.id.text_quilt_count); m_radio_import_new = (RadioButton) findViewById(R.id.radio_import_new); m_radio_import_replace = (RadioButton) findViewById(R.id.radio_import_replace); m_radio_import_merge = (RadioButton) findViewById(R.id.radio_import_merge); m_button_import = (Button) findViewById(R.id.button_import); m_button_import.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Repository repository = Repository.getDefaultRepository(OpenRepositoryActivity.this); repository.merge(m_repository, getMergeMode()); Toast.makeText(OpenRepositoryActivity.this, getString(R.string.toast_openRepository_success), Toast.LENGTH_SHORT).show(); finish(); } catch (RepositoryException e) { Handle.asRuntimeError(e); } } }); m_button_cancel_import = (Button) findViewById(R.id.button_cancel_import); m_button_cancel_import.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); if (m_repository != null) { try { m_text_theme_count.setText(Integer.toString(m_repository.getThemes().getCount())); m_text_block_count.setText(Integer.toString(m_repository.getBlocks().getCount())); m_text_quilt_count.setText(Integer.toString(m_repository.getQuilts().getCount())); } catch (RepositoryException e) { Handle.asRuntimeError(e); } } else { m_text_theme_count.setText("0"); m_text_block_count.setText("0"); m_text_quilt_count.setText("0"); } }
From source file:com.df.app.carsChecked.CarReportActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_car_report); Bundle bundle = getIntent().getExtras(); if (!bundle.containsKey("jsonString")) { finish();/*from w ww . j a va 2 s. c o m*/ } String jsonString = bundle.getString("jsonString"); InitViewPager(jsonString); InitTextView(); }
From source file:android.example.com.squawker.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //startService(new Intent(this, MyFirebaseInstanceIdService.class)); //new MyFirebaseInstanceIdService().onTokenRefresh(); mRecyclerView = (RecyclerView) findViewById(R.id.squawks_recycler_view); // Use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView mRecyclerView.setHasFixedSize(true); // Use a linear layout manager mLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(mLayoutManager); // Add dividers DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), mLayoutManager.getOrientation()); mRecyclerView.addItemDecoration(dividerItemDecoration); // Specify an adapter mAdapter = new SquawkAdapter(); mRecyclerView.setAdapter(mAdapter);/* w w w . ja v a 2 s.c o m*/ // Start the loader getSupportLoaderManager().initLoader(LOADER_ID_MESSAGES, null, this); Bundle extras = getIntent().getExtras(); if (extras != null && extras.containsKey("test")) { Log.d(LOG_TAG, extras.getString("test")); } }
From source file:net.reichholf.dreamdroid.loader.AsyncSimpleLoader.java
@SuppressWarnings("unchecked") private void init(Context context, AbstractSimpleRequestHandler handler, Bundle args) { mHandler = handler;/*from w w w. j a v a2s . c o m*/ DreamDroid.loadCurrentProfile(context); mShc = new SimpleHttpClient(); if (args != null && args.containsKey("params")) mParams = (ArrayList<NameValuePair>) args.getSerializable("params"); else mParams = null; }
From source file:co.ldln.android.ObjectCreateFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mActivity = (MainActivity) getActivity(); Bundle args = getArguments(); mSchemaKey = args.getString("schema_key"); if (args.containsKey("map_location_lat") && args.containsKey("map_location_lon")) { mMapLocation = args.getString("map_location_lat") + "," + args.getString("map_location_lon"); }/*from w w w . j a va 2 s. co m*/ mFormHolder = (LinearLayout) view.findViewById(R.id.form_holder); LDLN.readSchema(mActivity, this, mSchemaKey); }