List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.jacr.instagramtrendreader.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_main); /* Customizing ActionBar */ Resources r = getResources(); ActionBar ab = super.getActionBar(false); ab.setIcon(r.getDrawable(R.drawable.ic_menu_home)); ab.setTitle(Util.getTitleActivity(getString(R.string.title_my_gallery_app))); /* Views *///w ww.j a va 2 s. co m layoutThumbnail = (TableLayout) findViewById(R.id.layoutThumbnail); layoutThumbnail.setPadding(1, 1, 1, 1); /* Setting Viewpager and Indicator */ mPager = (ViewPager) findViewById(R.id.pagerMain); mAdapter = new ViewPagerAdapter<MainFragment>(getSupportFragmentManager()); mPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrollStateChanged(int arg0) { } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageSelected(int arg0) { int key = feedReader.getListThumbnailKeys().get(arg0); feedReader.highlightThumbnail(key); } }); /* Receiver */ mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Bundle extras = intent.getExtras(); if (action.contentEquals(ACTION_IMAGE_CLICK)) { int key = extras.getInt(ACTION_IMAGE_CLICK); if (key != -1) { Intent in = new Intent(Main.this, ImageDetails.class); Bundle b = new Bundle(); /* * Warning with Error FAILED BINDED TRANSACTION: it * happens When the transfer of "extras" out of memory. * in This case, when images are sent in intent. */ b.putSerializable(ImageDetails.KEY_THUMBNAIL_DATA, feedReader.getListThumbnailData()); b.putSerializable(ImageDetails.KEY_THUMBNAIL_KEYS, feedReader.getListThumbnailKeys()); b.putInt(ImageDetails.KEY_THUMBNAIL_ACTUAL_KEY, key); in.putExtras(b); startActivity(in); } } } }; IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_IMAGE_CLICK); registerReceiver(mReceiver, filter); /* Load data from Instagram */ cargarFeedReader(); }
From source file:com.pseudosudostudios.jdd.activities.GameActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { if (bg.tiles == null || bg.tiles[2][2] == null || bg == null) { super.onSaveInstanceState(outState); return;//from w ww . j a va 2 s. com } for (int r = 0; r < bg.tiles.length; r++) for (int c = 0; c < bg.tiles[r].length; c++) { outState.putIntArray(onSaveBaseString + r + c, bg.tiles[r][c].toIntArray()); if (bg.sol1 != null && bg.sol1[r][c] != null) outState.putIntArray(onSaveSolution + r + c, bg.sol1[r][c].toIntArray()); } try { outState.putIntArray(onSaveCeterTile, bg.getCenterTile().toIntArray()); } catch (NullPointerException e) { outState.putIntArray(onSaveCeterTile, bg.tiles[1][1].toIntArray()); } outState.putInt(bundleGameColors, Grid.numberOfColors); outState.putInt(jsonTileSize, Grid.tileSize); outState.putString(onSaveBaseString, bg.getDifficulty().toString()); outState.putInt(bundleGameColors, Grid.numberOfColors); outState.putLong(onSaveTime, bg.getTimeSinceStart()); }
From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java
private void handleLoadSkuList(final String productType) { if (asyncTask != null) return;//ww w. j a va2s . c om asyncTask = new AsyncTask<Void, Void, Bundle>() { @Override protected void onPreExecute() { Log.d(TAG, "handleLoadSkuList"); subscriptionActivity.setProgressBarIndeterminateVisibility(true); subscriptionActivity.setProgressBarVisibility(true); } private ArrayList<String> getSkuDetails(ArrayList<String> skuList, Bundle result) throws RemoteException { Bundle skuBundle = new Bundle(); skuBundle.putStringArrayList("ITEM_ID_LIST", skuList); Bundle skuDetails = subscriptionActivity.billingService.getSkuDetails(3, SubscriptionGoogleFragment.class.getPackage().getName(), productType, skuBundle); if (skuDetails.getInt("RESPONSE_CODE") == 0) return skuDetails.getStringArrayList("DETAILS_LIST"); else { Log.e(TAG, "sku details response code is != 0"); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return new ArrayList<String>(0); } } @Override protected Bundle doInBackground(Void... params) { Bundle result = new Bundle(); if (subscriptionActivity.billingService == null) { Log.e(TAG, "billing service is null"); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return result; } ArrayList<String> skuQueryList = new ArrayList<String>(2); skuQueryList.add(SKU_YEARLY_SUBSCRIPTION); try { List<String> skuDetails = getSkuDetails(skuQueryList, result); ArrayList<String> skuList = new ArrayList<String>(); if (result.getInt(ErrorToaster.KEY_STATUS_CODE, -1) != -1) return result; for (String thisResponse : skuDetails) { JSONObject productObject = new JSONObject(thisResponse); skuList.add(productObject.getString("productId")); } result.putStringArrayList("SKU_LIST", skuList); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (JSONException e) { Log.e(TAG, "error parsing sku details", e); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); } catch (RemoteException e) { Log.e(TAG, "error parsing sku details", e); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); } return result; } @Override protected void onPostExecute(Bundle result) { asyncTask = null; subscriptionActivity.setProgressBarIndeterminateVisibility(false); subscriptionActivity.setProgressBarVisibility(false); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) handleSkuListLoaded(result.getStringArrayList("SKU_LIST")); else ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result); } }.execute(); }
From source file:com.saulcintero.moveon.fragments.History.java
private void launchDatePickerDialog() { myDatePickerDialog date = new myDatePickerDialog(); Calendar calender = Calendar.getInstance(); Bundle args = new Bundle(); args.putInt("year", calender.get(Calendar.YEAR)); args.putInt("month", calender.get(Calendar.MONTH)); args.putInt("day", calender.get(Calendar.DAY_OF_MONTH)); switch (show_dialog) { case 0:/* ww w .j a v a2s. co m*/ date.setTitle(getString(R.string.start_date)); break; case 1: date.setTitle(getString(R.string.end_date)); } date.setArguments(args); date.setCallBack(ondate); date.show(getActivity().getSupportFragmentManager(), "Date Picker"); }
From source file:com.ferasinfotech.gwreader.ScreenSlidePageFragment.java
/** * Factory method for this fragment class. Constructs a new fragment for the given page number, * and JSON story object.//from w w w . j a v a2s . c o m */ public static ScreenSlidePageFragment create(int pageNumber, int numPages, JSONObject storyOrResponse) { int story_id = -1; String name = ""; String summary = ""; String headline = ""; String cover_photo_url = ""; String story_string = ""; long createdAt; ScreenSlidePageFragment fragment = new ScreenSlidePageFragment(); Bundle args = new Bundle(); if (pageNumber == 0) { // doing help page.. JSONobject parameter is server reponse try { createdAt = storyOrResponse.getLong(TAG_CREATEDAT); } catch (JSONException e) { createdAt = 0; } story_id = 0; name = "Grasswire Help"; headline = "Usage Instructions"; cover_photo_url = "android.resource://com.ferasinfotech.gwreader/" + R.drawable.gw_logo; summary = "Swipe right and left to read each story.\n\n" + "Scroll down to read facts and associated news items (tweets and links) for each story.\n\n" + "Tap on a news items within a story and you'll be able to follow web links, view tweets via the Twitter app, or watch videos.\n\n" + "A long press on a story's cover photo will launch the device browser to view or edit the story on the Grasswire mobile site.\n\n" + "A long press on the image above will launch the Grasswire main page.\n\n" + "News Feed Date: " + Utility.getDate(createdAt, "MM/dd/yyyy hh:mm") + "\n\n" + "App Version: " + BuildConfig.VERSION_NAME + "\n\n"; } else { // doing a story page, JSONobject parameter is the story data try { story_id = storyOrResponse.getInt(TAG_STORY_ID); name = storyOrResponse.getString(TAG_NAME) + " (" + pageNumber + "/" + numPages + ")"; summary = storyOrResponse.getString(TAG_SUMMARY); headline = storyOrResponse.getString(TAG_HEADLINE); cover_photo_url = storyOrResponse.getString(TAG_COVER_PHOTO); story_string = storyOrResponse.toString(); } catch (JSONException e) { name = "Unknown"; } } args.putInt(ARG_PAGE, pageNumber); args.putInt(ARG_STORY_ID, story_id); args.putString(ARG_TITLE, name); args.putString(ARG_SUMMARY, summary); args.putString(ARG_HEADLINE, headline); args.putString(ARG_COVER_PHOTO, cover_photo_url); args.putString(ARG_STORY_STRING, story_string); fragment.setArguments(args); return fragment; }
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putString(Constants.REPLY_TARGET_NAME_KEY, mReplyTargetName); state.putString(Constants.AFTER_KEY, mAfter); state.putString(Constants.BEFORE_KEY, mBefore); state.putInt(Constants.THREAD_COUNT_KEY, mCount); state.putString(Constants.LAST_AFTER_KEY, mLastAfter); state.putString(Constants.LAST_BEFORE_KEY, mLastBefore); state.putInt(Constants.THREAD_LAST_COUNT_KEY, mLastCount); state.putParcelable(Constants.VOTE_TARGET_THING_INFO_KEY, mVoteTargetThingInfo); state.putString(Constants.WHICH_INBOX_KEY, mWhichInbox); }
From source file:com.taw.gotothere.GoToThereActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { // Superclass handles map type, centre point of map and zoom level super.onSaveInstanceState(outState); Log.d(TAG, "onSaveInstanceState()"); GeoPoint pt = null;/* w w w . j av a 2s . c o m*/ pt = navigationOverlay.getSelectedLocation(); if (pt != null) { outState.putInt(END_LAT_KEY, pt.getLatitudeE6()); outState.putInt(END_LONG_KEY, pt.getLongitudeE6()); } pt = navigationOverlay.getStartLocation(); if (pt != null) { outState.putInt(START_LAT_KEY, pt.getLatitudeE6()); outState.putInt(START_LONG_KEY, pt.getLongitudeE6()); } // Whether we're placing a marker to navigate to outState.putBoolean(PLACING_MARKER_KEY, placingMarker); // Whether we're navigating to a point outState.putBoolean(NAVIGATING_KEY, navigating); if (navigating) { outState.putSerializable(DIRECTIONS_KEY, navigationOverlay.getDirections()); } SharedPreferences.Editor edit = getPreferences(Activity.MODE_PRIVATE).edit(); edit.putString(PREVIOUS_QUERY, searchTextView.getText().toString()).commit(); }
From source file:com.wirelessmoves.cl.MainActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); /* save variables */ savedInstanceState.putLong("NumberOfSignalStrengthUpdates", NumberOfSignalStrengthUpdates); savedInstanceState.putLong("LastCellId", LastCellId); savedInstanceState.putLong("NumberOfCellChanges", NumberOfCellChanges); savedInstanceState.putLong("LastLacId", LastLacId); savedInstanceState.putLong("NumberOfLacChanges", NumberOfLacChanges); savedInstanceState.putLongArray("PreviousCells", PreviousCells); savedInstanceState.putInt("PreviousCellsIndex", PreviousCellsIndex); savedInstanceState.putLong("NumberOfUniqueCellChanges", NumberOfUniqueCellChanges); savedInstanceState.putBoolean("outputDebugInfo", outputDebugInfo); savedInstanceState.putDouble("CurrentLocationLong", CurrentLocationLong); savedInstanceState.putDouble("CurrentLocationLat", CurrentLocationLat); /* save the trace data still in the write buffer into a file */ saveDataToFile(FileWriteBufferStr,// www.j a v a 2 s . c om "---in save instance, " + DateFormat.getTimeInstance().format(new Date()) + "\r\n"); FileWriteBufferStr = ""; }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
public void semiandrill(String schoolid, String principal, String contact, String schoolcode, String address, String phone, String aedemail, String principalemail, String drillis, int position, String contactphone, String state, String city, String zip) { ll2.setBackgroundColor(getResources().getColor(R.color.White)); ll1.setBackgroundColor(getResources().getColor(R.color.FullTransparent)); ll3.setBackgroundColor(getResources().getColor(R.color.FullTransparent)); ll4.setBackgroundColor(getResources().getColor(R.color.FullTransparent)); ll5.setBackgroundColor(getResources().getColor(R.color.FullTransparent)); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Semiannualdrill myf = new Semiannualdrill(); Bundle bundle = new Bundle(); bundle.putString("schoolid", schoolid); bundle.putString("principal", principal); bundle.putString("contact", contact); bundle.putString("schoolcode", schoolcode); bundle.putString("address", address); bundle.putString("phone", phone); bundle.putString("contactemail", aedemail); bundle.putString("principalemail", principalemail); bundle.putString("drillid", drillis); bundle.putInt("pos", position); bundle.putString("contactphone", contactphone); bundle.putString("state", state); bundle.putString("city", city); bundle.putString("zip", zip); myf.setArguments(bundle);//from ww w. jav a 2s .c om transaction.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right); transaction.replace(R.id.frame, myf, "Drill"); transaction.addToBackStack(null); transaction.commit(); }