List of usage examples for android.os Bundle putLong
public void putLong(@Nullable String key, long value)
From source file:com.dwdesign.tweetings.activity.DraftsActivity.java
private void composeDraft(final DraftItem draft) { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); final Uri image_uri = draft.media_uri == null ? null : Uri.parse(draft.media_uri); bundle.putString(INTENT_KEY_TEXT, draft.text); bundle.putLongArray(INTENT_KEY_IDS, draft.account_ids); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, draft.in_reply_to_status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, draft.in_reply_to_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, draft.in_reply_to_screen_name); bundle.putParcelable(INTENT_KEY_IMAGE_URI, image_uri); bundle.putBoolean(INTENT_KEY_IS_IMAGE_ATTACHED, draft.is_image_attached); bundle.putBoolean(INTENT_KEY_IS_PHOTO_ATTACHED, draft.is_photo_attached); bundle.putBoolean(INTENT_KEY_IS_QUOTE, draft.is_quote); intent.putExtras(bundle);/*from w w w .j ava 2 s . c o m*/ mResolver.delete(Drafts.CONTENT_URI, Drafts._ID + " = " + draft._id, null); startActivityForResult(intent, REQUEST_COMPOSE); }
From source file:com.googlecode.android_scripting.facade.AndroidFacade.java
private static void putNestedJSONObject(JSONObject jsonObject, Bundle bundle) throws JSONException { JSONArray names = jsonObject.names(); for (int i = 0; i < names.length(); i++) { String name = names.getString(i); Object data = jsonObject.get(name); if (data == null) { continue; }// w ww . ja v a2 s . c om if (data instanceof Integer) { bundle.putInt(name, ((Integer) data).intValue()); } if (data instanceof Float) { bundle.putFloat(name, ((Float) data).floatValue()); } if (data instanceof Double) { bundle.putDouble(name, ((Double) data).doubleValue()); } if (data instanceof Long) { bundle.putLong(name, ((Long) data).longValue()); } if (data instanceof String) { bundle.putString(name, (String) data); } if (data instanceof Boolean) { bundle.putBoolean(name, ((Boolean) data).booleanValue()); } // Nested JSONObject if (data instanceof JSONObject) { Bundle nestedBundle = new Bundle(); bundle.putBundle(name, nestedBundle); putNestedJSONObject((JSONObject) data, nestedBundle); } // Nested JSONArray. Doesn't support mixed types in single array if (data instanceof JSONArray) { // Empty array. No way to tell what type of data to pass on, so skipping if (((JSONArray) data).length() == 0) { Log.e("Empty array not supported in nested JSONObject, skipping"); continue; } // Integer if (((JSONArray) data).get(0) instanceof Integer) { int[] integerArrayData = new int[((JSONArray) data).length()]; for (int j = 0; j < ((JSONArray) data).length(); ++j) { integerArrayData[j] = ((JSONArray) data).getInt(j); } bundle.putIntArray(name, integerArrayData); } // Double if (((JSONArray) data).get(0) instanceof Double) { double[] doubleArrayData = new double[((JSONArray) data).length()]; for (int j = 0; j < ((JSONArray) data).length(); ++j) { doubleArrayData[j] = ((JSONArray) data).getDouble(j); } bundle.putDoubleArray(name, doubleArrayData); } // Long if (((JSONArray) data).get(0) instanceof Long) { long[] longArrayData = new long[((JSONArray) data).length()]; for (int j = 0; j < ((JSONArray) data).length(); ++j) { longArrayData[j] = ((JSONArray) data).getLong(j); } bundle.putLongArray(name, longArrayData); } // String if (((JSONArray) data).get(0) instanceof String) { String[] stringArrayData = new String[((JSONArray) data).length()]; for (int j = 0; j < ((JSONArray) data).length(); ++j) { stringArrayData[j] = ((JSONArray) data).getString(j); } bundle.putStringArray(name, stringArrayData); } // Boolean if (((JSONArray) data).get(0) instanceof Boolean) { boolean[] booleanArrayData = new boolean[((JSONArray) data).length()]; for (int j = 0; j < ((JSONArray) data).length(); ++j) { booleanArrayData[j] = ((JSONArray) data).getBoolean(j); } bundle.putBooleanArray(name, booleanArrayData); } } } }
From source file:rpassmore.app.fillthathole.ViewHazardActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putLong(SAVED_HAZARD_ID, hazard.getId()); }
From source file:com.dwdesign.tweetings.fragment.DMConversationFragment.java
public void showConversation(final long account_id, final long conversation_id) { final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, account_id); args.putLong(INTENT_KEY_CONVERSATION_ID, conversation_id); getLoaderManager().restartLoader(0, args, this); }
From source file:com.launcher.silverfish.launcher.appdrawer.TabFragmentHandler.java
private void attachTabFragment(TabInfo tab, FragmentTransaction ft) { // Retrieve the fragment String fragment_tag = tab.getTag(); AppDrawerTabFragment fragment = (AppDrawerTabFragment) mFragmentManager.findFragmentByTag(fragment_tag); // Attach it to the UI if an instance already exists, otherwise create a new instance and add it. if (fragment == null) { // send the tab id to each tab Bundle args = new Bundle(); args.putLong(Constants.TAB_ID, tab.getId()); fragment = new AppDrawerTabFragment(); fragment.setArguments(args);/*from w ww .j av a2s . c o m*/ ft.add(R.id.realtabcontent, fragment, fragment_tag); } else { ft.attach(fragment); } }
From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { if (!CurrencyValue.isNullOrZero(_amount)) { outState.putSerializable(AMOUNT, _amount); }/*w ww . j a v a 2 s . c o m*/ outState.putLong(RECEIVING_SINCE, _receivingSince); outState.putInt(SYNC_ERRORS, _syncErrors); outState.putSerializable(LAST_ADDRESS_BALANCE, _lastAddressBalance); super.onSaveInstanceState(outState); }
From source file:com.nearnotes.MainActivity.java
/** * onNoteSelected creates a new NoteEdit object as a fragment and * attachs the unique rowId for the not to be displayed in a bundle * before calling the fragment manager to display * //from ww w. ja v a2 s. co m * @param id * The unique rowId for the particular note. */ @Override public void onNoteSelected(long id) { NoteEdit newFragment = new NoteEdit(); Bundle args = new Bundle(); args.putLong("_id", id); newFragment.setArguments(args); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, newFragment); transaction.addToBackStack(null); transaction.commit(); }
From source file:com.lambdasoup.quickfit.ui.WorkoutListActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putLong(KEY_SHOW_WORKOUT_ID, idToSelect); outState.putLong(KEY_SELECTED_ITEM_ID, workoutsAdapter.getSelectedItemId()); }
From source file:edu.mit.media.funf.configured.ConfiguredPipeline.java
public void onDataReceived(Bundle data) { String dataJson = getBundleSerializer().serialize(data); String probeName = data.getString(Probe.PROBE); long timestamp = data.getLong(Probe.TIMESTAMP, 0L); Bundle b = new Bundle(); b.putString(NameValueDatabaseService.DATABASE_NAME_KEY, getPipelineName()); b.putLong(NameValueDatabaseService.TIMESTAMP_KEY, timestamp); b.putString(NameValueDatabaseService.NAME_KEY, probeName); b.putString(NameValueDatabaseService.VALUE_KEY, dataJson); Intent i = new Intent(this, getDatabaseServiceClass()); i.setAction(DatabaseService.ACTION_RECORD); i.putExtras(b);//from w w w . ja v a 2 s . c o m startService(i); }
From source file:com.nearnotes.MainActivity.java
public boolean fetchFirstNote() { Cursor notesCursor = mDbHelper.fetchAllNotes(this, mLongitude, mLatitude); if (notesCursor.getCount() > 0) { notesCursor.moveToFirst();/* ww w. j ava 2 s .com*/ NoteEdit newFragment1 = new NoteEdit(); Bundle newBundle = new Bundle(); newBundle.putLong(NotesDbAdapter.KEY_ROWID, notesCursor.getLong(0)); replaceFragment(newFragment1, newBundle); return true; } else { Toast.makeText(this, "No Notes Yet", Toast.LENGTH_SHORT).show(); return false; } }