List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.skubit.android.billing.BillingServiceBinder.java
@Override public Bundle getDirectAuthorizationIntent(int apiVersion, String userId, String packageName, String scopes) throws RemoteException { Bundle bundle = new Bundle(); if (apiVersion != 1) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; }/* w ww . j a v a 2s . c o m*/ int packValidate = validatePackageIsOwnedByCaller(packageName); if (packValidate != BillingResponseCodes.RESULT_OK) { Log.d(TAG, "Package is not owned by caller: " + packageName); bundle.putInt("RESPONSE_CODE", packValidate); return bundle; } return null; }
From source file:com.example.android.imaginarium.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(SAVED_PROGRESS, mSignInProgress); }
From source file:com.chess.genesis.data.GameDataDB.java
public Bundle newLocalGame(final String gamename, final int gametype, final int opponent) { final long time = System.currentTimeMillis(); final Object[] data = { gamename, time, time, gametype, opponent }; final String[] data2 = { String.valueOf(time) }; db.execSQL("INSERT INTO localgames (name, ctime, stime, gametype, opponent) VALUES (?, ?, ?, ?, ?);", data); final Bundle game = rowToBundle(db.rawQuery("SELECT * FROM localgames WHERE ctime=?", data2), 0, true); game.putInt("type", Enums.LOCAL_GAME); return game;/*from www . j av a2 s . c om*/ }
From source file:com.google.android.apps.authenticator.dataexport.Exporter.java
private Bundle getPreferencesBundle(SharedPreferences preferences) { Map<String, ?> preferencesMap = preferences.getAll(); if (preferencesMap == null) { preferencesMap = Collections.emptyMap(); }//from w ww. java 2s . co m Bundle result = new Bundle(); for (String key : preferencesMap.keySet()) { Object value = preferencesMap.get(key); if (value instanceof Boolean) { result.putBoolean(key, (Boolean) value); } else if (value instanceof Float) { result.putFloat(key, (Float) value); } else if (value instanceof Integer) { result.putInt(key, (Integer) value); } else if (value instanceof Long) { result.putLong(key, (Long) value); } else if (value instanceof String) { result.putString(key, (String) value); } else { // Can only be Set<String> at the moment (API Level 11+), which we don't use anyway. // Ignore this type of preference, since losing preferences on export is not lethal } } return result; }
From source file:com.aknowledge.v1.automation.RemoteActivity.java
@Override public void onSaveInstanceState(Bundle outState) { // Serialize the current dropdown position. outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, getActionBar().getSelectedNavigationIndex()); }
From source file:com.skubit.android.billing.BillingServiceBinder.java
@Override public Bundle getAuthorizationIntent(int apiVersion, String packageName, String scopes) throws RemoteException { Bundle bundle = new Bundle(); if (apiVersion != 1) { bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE); return bundle; }/*from w w w . j av a 2s .c o m*/ int packValidate = validatePackageIsOwnedByCaller(packageName); if (packValidate != BillingResponseCodes.RESULT_OK) { Log.d(TAG, "Package is not owned by caller: " + packageName); bundle.putInt("RESPONSE_CODE", packValidate); return bundle; } Intent authorizationIntent = makeAuthorizationIntent(packageName, scopes); PendingIntent pending = PendingIntent.getActivity(mContext, (packageName + ":").hashCode(), authorizationIntent, 0); bundle.putParcelable("AUTHORIZATION_INTENT", pending); bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_OK); return bundle; }
From source file:com.example.main.BandWViewPagerActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { // Save away the original text, so we still have it if the activity // needs to be killed while paused. super.onSaveInstanceState(savedInstanceState); savedInstanceState.putString("ALL_List", List2String()); savedInstanceState.putInt("index", index); GlobalID globalID = ((GlobalID) getApplication()); globalID.create_notification("", "", "", false, false, false, BandWViewPagerActivity.class.getName()); if (globalID.toast != null) globalID.toast.cancel();//from www. j a va 2 s . c o m }
From source file:com.fsa.en.dron.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RateThisApp.Config config = new RateThisApp.Config(5, 10); config.setTitle(R.string.my_own_title); config.setMessage(R.string.my_own_message); config.setYesButtonText(R.string.my_own_rate); config.setNoButtonText(R.string.my_own_thanks); config.setCancelButtonText(R.string.my_own_cancel); RateThisApp.init(config);//from ww w .j ava 2 s .co m RateThisApp.setCallback(new RateThisApp.Callback() { @Override public void onYesClicked() { final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } } @Override public void onNoClicked() { TastyToast.makeText(getApplicationContext(), "Vuelve pronto!", TastyToast.LENGTH_LONG, TastyToast.INFO); } @Override public void onCancelClicked() { TastyToast.makeText(getApplicationContext(), "Prometo tomar mejores fotografias!", TastyToast.LENGTH_LONG, TastyToast.ERROR); } }); button = (Button) findViewById(R.id.button); button.setVisibility(View.INVISIBLE); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { checkConnection(); } }); BottomNavigationBar bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar); bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE); bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED); bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC); bottomNavigationBar.setBarBackgroundColor(R.color.material_light_blue_800); bottomNavigationBar.setActiveColor(R.color.material_grey_900); bottomNavigationBar.setInActiveColor(R.color.material_blue_grey_200); bottomNavigationBar.addItem(new BottomNavigationItem(R.drawable.compose, "Mensaje")) .addItem(new BottomNavigationItem(R.drawable.sociales, "Sociales")) .addItem(new BottomNavigationItem(R.drawable.share, "Cuntale a un amigo")).initialise(); bottomNavigationBar.setTabSelectedListener(new BottomNavigationBar.OnTabSelectedListener() { @Override public void onTabSelected(int position) { switch (position) { case 0: Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[] { "marceloespinoza00@gmail.com" }); email.putExtra(Intent.EXTRA_SUBJECT, "Formosa en dron"); email.putExtra(Intent.EXTRA_TEXT, "Dej tu mensaje"); email.setType("message/rfc822"); startActivity(Intent.createChooser(email, "Elige un cliente :")); break; case 1: Intent intent = new Intent(getApplication(), FacebookActivity.class); startActivity(intent); break; case 2: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Formosa en dron"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.fsa.en.dron"); startActivity(Intent.createChooser(sharingIntent, "Compartir via")); break; } } @Override public void onTabUnselected(int position) { } @Override public void onTabReselected(int position) { switch (position) { case 0: break; case 1: Intent intent = new Intent(getApplication(), FacebookActivity.class); startActivity(intent); break; case 2: break; } } }); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); LayoutInflater inflator = LayoutInflater.from(this); View v = inflator.inflate(R.layout.toolbar_title, null); Typeface budget = Typeface.createFromAsset(getAssets(), "fonts/Budget.otf"); Typeface typographica = Typeface.createFromAsset(getAssets(), "fonts/TypoGraphica.otf"); TextView mToolbarCustomTitle = (TextView) v.findViewById(R.id.title); TextView mToolbarCustomSubTitle = (TextView) v.findViewById(R.id.subtitle); mToolbarCustomTitle.setText("Formosa"); mToolbarCustomSubTitle.setText("en dron"); mToolbarCustomTitle.setTypeface(typographica); mToolbarCustomSubTitle.setTypeface(budget); getSupportActionBar().setCustomView(v); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowCustomEnabled(true); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int id = item.getItemId(); if (id == R.id.recargar) { checkConnection(); } if (id == R.id.info) { showDialog(); } return false; } }); recyclerView = (RecyclerView) findViewById(R.id.recycler_view); recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(getApplicationContext(), recyclerView, new GalleryAdapter.ClickListener() { @Override public void onClick(View view, int position) { Bundle bundle = new Bundle(); bundle.putSerializable("images", images); bundle.putInt("position", position); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); SlideshowDialogFragment newFragment = SlideshowDialogFragment.newInstance(); newFragment.setArguments(bundle); newFragment.show(ft, "slideshow"); } @Override public void onLongClick(View view, int position) { } })); pDialog = new ProgressDialog(this); images = new ArrayList<>(); mAdapter = new GalleryAdapter(getApplicationContext(), images); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getApplicationContext(), 2); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); }
From source file:com.google.firebase.quickstart.analytics.webview.AnalyticsWebInterface.java
private Bundle bundleFromJson(String json) { // [START_EXCLUDE] if (TextUtils.isEmpty(json)) { return new Bundle(); }/*from w w w . j av a 2 s .c o m*/ Bundle result = new Bundle(); try { JSONObject jsonObject = new JSONObject(json); Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = keys.next(); Object value = jsonObject.get(key); if (value instanceof String) { result.putString(key, (String) value); } else if (value instanceof Integer) { result.putInt(key, (Integer) value); } else if (value instanceof Double) { result.putDouble(key, (Double) value); } else { Log.w(TAG, "Value for key " + key + " not one of [String, Integer, Double]"); } } } catch (JSONException e) { Log.w(TAG, "Failed to parse JSON, returning empty Bundle.", e); return new Bundle(); } return result; // [END_EXCLUDE] }
From source file:com.irccloud.android.fragment.EditConnectionFragment.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { if (server != null) savedInstanceState.putInt("cid", server.cid); }