List of usage examples for android.os Bundle getInt
public int getInt(String key, int defaultValue)
From source file:com.tdispatch.passenger.StartActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras != null) { mMode = extras.getInt(Const.Bundle.MODE, MODE_NORMAL); }/*from www . jav a2 s. c om*/ setContentView(R.layout.start_activity); mSeenTheTourAlready = mPrefs.getBoolean(PREFS_SEEN_TOUR, false); switch (mMode) { case MODE_TOUR: { mTourOnUserRequest = true; showTour(); } break; case MODE_NORMAL: { int errorCode = TDApplication.getGoogleServicesCheckReturnCode(); Dialog errorDialog; if (errorCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) { errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, this, 26354); if (errorDialog != null) { errorDialog.show(); } } } else { AccountData userProfile = TDApplication.getSessionManager().getAccountData(); // check if we are currently logged. if not show the correct fragment if (userProfile == null) { if (mSeenTheTourAlready) { showStart(); } else { showTour(); } } else { Long expires = TDApplication.getSessionManager().getAccessTokenExpirationMillis(); if (expires > 0) { showMapView(); } else { TDApplication.getSessionManager().doLogout(); showStart(); } } } } break; } }
From source file:cgeo.geocaching.AboutActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.viewpager_activity); int startPage = Page.VERSION.ordinal(); final Bundle extras = getIntent().getExtras(); if (extras != null) { startPage = extras.getInt(EXTRA_ABOUT_STARTPAGE, startPage); }/*from w w w . j a va 2s. c om*/ createViewPager(startPage, null); reinitializeViewPager(); }
From source file:eu.faircode.adblocker.IAB.java
public List<String> getPurchases() throws RemoteException { // Get purchases Bundle bundle = service.getPurchases(IAB_VERSION, context.getPackageName(), "inapp", null); Log.i(TAG, "getPurchases"); Util.logBundle(bundle);/*from w w w .jav a2s . c om*/ int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1)); Log.i(TAG, "Response=" + getResult(response)); if (response != 0) throw new IllegalArgumentException(getResult(response)); ArrayList<String> details = bundle.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); return (details == null ? new ArrayList<String>() : details); }
From source file:com.teinproductions.tein.papyrosprogress.MainActivity.java
private void restoreAppWidgetStuff() { if (Build.VERSION.SDK_INT < 16) return;/*from w ww .j a v a 2 s. c om*/ Bundle extras = getIntent().getExtras(); if (extras != null) { appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); adapter.setTextSize(pref.getInt(Constants.TEXT_SIZE_PREFERENCE + appWidgetId, 24)); adapter.setWidgetMilestoneTitle( pref.getString(Constants.MILESTONE_WIDGET_PREFERENCE + appWidgetId, null)); } else { adapter.setTextSize(PapyrosRecyclerAdapter.DONT_SHOW_TEXT_SIZE_TILE); } }
From source file:com.github.ajasmin.telususageandroidwidget.ReportAccountErrorActivity.java
private void retriveAppWidgetId() { Intent intent = getIntent();/*from ww w .java2 s . co m*/ Bundle extras = intent.getExtras(); appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; if (extras != null) { appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } // Finish the activity if we don't receive an appWidgetId if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) finish(); }
From source file:eu.faircode.adblocker.IAB.java
public PendingIntent getBuyIntent(String sku) throws RemoteException { if (service == null) return null; Bundle bundle = service.getBuyIntent(IAB_VERSION, context.getPackageName(), sku, "inapp", "adblocker"); Log.i(TAG, "getBuyIntent"); Util.logBundle(bundle);// ww w . ja v a2 s.c om int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1)); Log.i(TAG, "Response=" + getResult(response)); if (response != 0) throw new IllegalArgumentException(getResult(response)); if (!bundle.containsKey("BUY_INTENT")) throw new IllegalArgumentException("BUY_INTENT missing"); return bundle.getParcelable("BUY_INTENT"); }
From source file:eu.faircode.adblocker.IAB.java
public boolean isAvailable(String sku) throws RemoteException, JSONException { // Get available SKUs ArrayList<String> skuList = new ArrayList<>(); skuList.add(sku);/*w w w .j a v a 2 s . c o m*/ Bundle query = new Bundle(); query.putStringArrayList("ITEM_ID_LIST", skuList); Bundle bundle = service.getSkuDetails(IAB_VERSION, context.getPackageName(), "inapp", query); Log.i(TAG, "getSkuDetails"); Util.logBundle(bundle); int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1)); Log.i(TAG, "Response=" + getResult(response)); if (response != 0) throw new IllegalArgumentException(getResult(response)); // Check available SKUs boolean found = false; ArrayList<String> details = bundle.getStringArrayList("DETAILS_LIST"); if (details != null) for (String item : details) { JSONObject object = new JSONObject(item); if (sku.equals(object.getString("productId"))) { found = true; break; } } Log.i(TAG, sku + "=" + found); return found; }
From source file:cn.newgxu.android.bbs.ui.RepliesFragment.java
@Override public void onStart() { super.onStart(); Bundle arguments = getArguments(); // new fetchReplies().execute(arguments.getInt("tid", 0), arguments.getInt("last_rid", 0)); new fetchReplies().execute(arguments.getInt(Consts.TID, 0), arguments.getInt(Consts.LAST_RID, 0)); }
From source file:cn.newgxu.android.bbs.ui.ForumsTopicsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { this.mPostion = savedInstanceState.getInt(LAST_POS, 0); }/*from w w w .ja va 2s. c om*/ Log.d(TAG, "on create pos: " + mPostion); }
From source file:io.github.carlorodriguez.alarmon.AlarmClockService.java
private void handleStart(Intent intent) { if (intent != null && intent.hasExtra(COMMAND_EXTRA)) { Bundle extras = intent.getExtras(); int command = extras.getInt(COMMAND_EXTRA, COMMAND_UNKNOWN); final Handler handler = new Handler(); final Runnable maybeShutdown = new Runnable() { @Override//from ww w . j a va2s .c o m public void run() { if (pendingAlarms.size() == 0) { stopSelf(); } } }; switch (command) { case COMMAND_NOTIFICATION_REFRESH: refreshNotification(); handler.post(maybeShutdown); break; case COMMAND_DEVICE_BOOT: fixPersistentSettings(); handler.post(maybeShutdown); break; case COMMAND_TIMEZONE_CHANGE: if (AppSettings.isDebugMode(getApplicationContext())) { Toast.makeText(getApplicationContext(), "TIMEZONE CHANGE, RESCHEDULING...", Toast.LENGTH_SHORT) .show(); } for (long alarmId : pendingAlarms.pendingAlarms()) { scheduleAlarm(alarmId); if (AppSettings.isDebugMode(getApplicationContext())) { Toast.makeText(getApplicationContext(), "ALARM " + alarmId, Toast.LENGTH_SHORT).show(); } } handler.post(maybeShutdown); break; default: throw new IllegalArgumentException("Unknown service command."); } } }