List of usage examples for android.os Bundle getLong
public long getLong(String key)
From source file:com.stoneapp.ourvlemoodle2.fragments.CourseContentFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { this.coursefname = args.getString("coursefname"); this.coursename = args.getString("coursename"); this.coursepid = args.getLong("coursepid"); this.courseid = args.getInt("courseid"); this.token = args.getString("token"); this.siteid = args.getLong("siteid"); }/*from w ww . j a v a 2 s .c o m*/ setHasOptionsMenu(true); }
From source file:com.github.kanata3249.ffxieq.android.AugmentEditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Bundle param; super.onCreate(savedInstanceState); if (savedInstanceState != null) { param = savedInstanceState;//from ww w . j a v a2 s .c o m } else { param = getIntent().getExtras(); } mPart = param.getInt("Part"); mBaseID = param.getLong("BaseId"); mAugID = param.getLong("AugId"); setContentView(R.layout.augmentedit); }
From source file:com.joulespersecond.seattlebusbot.ReportTripProblemFragment.java
@Override protected ReportLoader createLoader(Bundle args) { // Trip ID//from w w w . j a va 2s . co m String tripId = args.getString(TRIP_ID); ObaReportProblemWithTripRequest.Builder builder = new ObaReportProblemWithTripRequest.Builder(getActivity(), tripId); builder.setStopId(args.getString(STOP_ID)); builder.setVehicleId(args.getString(TRIP_VEHICLE_ID)); builder.setServiceDate(args.getLong(TRIP_SERVICE_DATE)); // Code String code = SPINNER_TO_CODE[mCodeView.getSelectedItemPosition()]; if (code != null) { builder.setCode(code); } // Comment CharSequence comment = mUserComment.getText(); if (!TextUtils.isEmpty(comment)) { builder.setUserComment(comment.toString()); } // Location / Location accuracy Location location = LocationHelp.getLocation2(getActivity(), mLocationClient); if (location != null) { builder.setUserLocation(location.getLatitude(), location.getLongitude()); if (location.hasAccuracy()) { builder.setUserLocationAccuracy((int) location.getAccuracy()); } } // User on vehicle? builder.setUserOnVehicle(mUserOnVehicle.isChecked()); // User Vehicle Number CharSequence vehicleNum = mUserVehicle.getText(); if (!TextUtils.isEmpty(vehicleNum)) { builder.setUserVehicleNumber(vehicleNum.toString()); } return new ReportLoader(getActivity(), builder.build()); }
From source file:com.andryr.musicplayer.fragments.ArtistFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); setHasOptionsMenu(true);//from w ww. java 2s. com if (args != null) { long id = args.getLong(PARAM_ARTIST_ID); String name = args.getString(PARAM_ARTIST_NAME); int albumCount = args.getInt(PARAM_ALBUM_COUNT); int trackCount = args.getInt(PARAM_TRACK_COUNT); mArtist = new Artist(id, name, albumCount, trackCount); } mArtistImageWidth = getResources().getDimensionPixelSize(R.dimen.artist_image_req_width); mArtistImageHeight = getResources().getDimensionPixelSize(R.dimen.artist_image_req_height); mArtworkSize = getResources().getDimensionPixelSize(R.dimen.art_size); }
From source file:com.ultramegasoft.flavordex2.fragment.ViewPhotosFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); if (args != null) { mEntryId = args.getLong(ViewEntryFragment.ARG_ENTRY_ID); }//www . j ava 2 s .c o m if (savedInstanceState != null) { mCurrentItem = savedInstanceState.getInt(STATE_CURRENT_ITEM, mCurrentItem); } }
From source file:de.spiritcroc.ownlog.ui.fragment.TagItemEditFragment.java
private boolean restoreValues(Bundle savedInstanceState) { if (savedInstanceState == null) { return false; }//from w ww . j ava 2 s . co m try { if (savedInstanceState.containsKey(KEY_ADD_ITEM)) { mAddItem = savedInstanceState.getBoolean(KEY_ADD_ITEM); mEditItemId = savedInstanceState.getLong(KEY_EDIT_ITEM_ID); mInitName = savedInstanceState.getString(KEY_INIT_NAME); mEditTagName.setText(savedInstanceState.getString(KEY_SET_NAME)); mInitDescription = savedInstanceState.getString(KEY_INIT_DESCRIPTION); mEditTagDescription.setText(savedInstanceState.getString(KEY_SET_DESCRIPTION)); mShouldHideKeyboardOnExit = savedInstanceState.getBoolean(KEY_SHOULD_HIDE_KEYBOARD_ON_DISMISS); return true; } } catch (Exception e) { e.printStackTrace(); } return false; }
From source file:com.eleybourn.bookcatalogue.goodreads.api.ListReviewsApiHandler.java
/** * //from w ww . ja va2s . c o m * @param page * @return * @throws ClientProtocolException * @throws OAuthMessageSignerException * @throws OAuthExpectationFailedException * @throws OAuthCommunicationException * @throws NotAuthorizedException * @throws BookNotFoundException * @throws IOException * @throws NetworkException */ public Bundle run(int page, int perPage) throws ClientProtocolException, OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException, NotAuthorizedException, BookNotFoundException, IOException, NetworkException { long t0 = System.currentTimeMillis(); // Sort by update_dte (descending) so sync is faster. Specify 'shelf=all' because it seems goodreads returns // the shelf that is selected in 'My Books' on the web interface by default. final String urlBase = "http://www.goodreads.com/review/list/%4$s.xml?key=%1$s&v=2&page=%2$s&per_page=%3$s&sort=date_updated&order=d&shelf=all"; final String url = String.format(urlBase, mManager.getDeveloperKey(), page, perPage, mManager.getUserid()); HttpGet get = new HttpGet(url); // Get a handler and run query. XmlResponseParser handler = new XmlResponseParser(mRootFilter); // Even thought it's only a GET, it needs a signature. mManager.execute(get, handler, true); // When we get here, the data has been collected but needs to be processed into standard form. Bundle results = mFilters.getData(); // Return parsed results. long t1 = System.currentTimeMillis(); System.out.println("Found " + results.getLong(TOTAL) + " books in " + (t1 - t0) + "ms"); return results; }
From source file:rpassmore.app.fillthathole.ViewHazardActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case PICK_PHOTO_ACTIVITY: { if (resultCode == RESULT_OK) { Bitmap bitmap;//from www. j av a 2 s .co m try { bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(data.getData())); storeNewPhoto(bitmap, data.getData().toString()); } catch (FileNotFoundException ex) { Log.e(getPackageName(), "Error loading image file", ex); } } break; } case PICTURE_ACTIVITY: { if (resultCode == RESULT_OK) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(capturedImageURI, projection, null, null, null); int column_index_data = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); String capturedImageFilePath = cursor.getString(column_index_data); Bitmap bitmap = BitmapFactory.decodeFile(capturedImageFilePath); storeNewPhoto(bitmap, capturedImageFilePath); } break; } case LOCATION_MAP_ACTIVITY: { if (resultCode == RESULT_OK) { Bundle extras = data.getExtras(); if (extras != null) { hazard.setLattitude(extras.getLong(LocationActivity.LOCATION_LAT) / 1.0E6); hazard.setLongitude(extras.getLong(LocationActivity.LOCATION_LONG) / 1.0E6); if (extras.getString("Address") != null) { hazard.setAddress(extras.getString(LocationActivity.LOCATION_ADDRESS)); } } } break; } } }
From source file:com.dabay6.android.apps.carlog.ui.base.fragments.BaseDetailFragment.java
/** * {@inheritDoc}//from ww w . j a v a 2 s . co m */ @Override protected void setupListView(final Bundle savedInstanceState) { final Bundle bundle = getArguments(); setEmptyText(getString(getEmptyTextResourceId())); adapter = new SimpleTwoLineAdapter(getActivity(), new ArrayList<Map<String, String>>(), getListItemResourceId()); setListAdapter(adapter); if (bundle != null && bundle.containsKey(PARAMS_ENTITY_ID)) { entityId = bundle.getLong(PARAMS_ENTITY_ID); } if (savedInstanceState != null && savedInstanceState.containsKey(KEY_ENTITY_ID)) { entityId = savedInstanceState.getLong(KEY_ENTITY_ID); } if (entityId != null) { getLoaderManager().initLoader(ENTITY_LOADER_ID, null, this); setListShown(false); } else { setListShownNoAnimation(true); } }
From source file:com.ichi2.anki.FilteredDeckOptions.java
@Override protected void onCreate(Bundle icicle) { Themes.setThemeLegacy(this); super.onCreate(icicle); mCol = CollectionHelper.getInstance().getCol(this); if (mCol == null) { finish();// w w w . ja v a 2s . c o m return; } Bundle extras = getIntent().getExtras(); if (extras != null && extras.containsKey("did")) { mDeck = mCol.getDecks().get(extras.getLong("did")); } else { mDeck = mCol.getDecks().current(); } registerExternalStorageListener(); try { if (mCol == null || mDeck.getInt("dyn") != 1) { Timber.w("No Collection loaded or deck is not a dyn deck"); finish(); return; } else { mPref = new DeckPreferenceHack(); mPref.registerOnSharedPreferenceChangeListener(this); this.addPreferencesFromResource(R.xml.cram_deck_options); this.buildLists(); this.updateSummaries(); } } catch (JSONException e) { throw new RuntimeException(e); } // Set the activity title to include the name of the deck String title = getResources().getString(R.string.deckpreferences_title); if (title.contains("XXX")) { try { title = title.replace("XXX", mDeck.getString("name")); } catch (JSONException e) { title = title.replace("XXX", "???"); } } this.setTitle(title); // Add a home button to the actionbar getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }