List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:com.noah.lol.network.RequestNetwork.java
protected void asyncRequestGet(final String url, final NetworkListener<String> listener) { if (url == null) { return;/*from w ww . j a va 2 s . c o m*/ } try { environmentCheck(); } catch (EnvironmentException e) { if (listener != null) { e.setStatus(BAD_REQUEST_ENVIRONMENT_CONFIG); listener.onNetworkFail(BAD_REQUEST_ENVIRONMENT_CONFIG, e); } return; } final Handler handler = new Handler() { @Override public void handleMessage(Message msg) { Bundle bundle = msg.getData(); switch (msg.what) { case REQUEST_SUCCESS: String responseBody = bundle.getString(RESPONSE_KEY); if (listener != null && responseBody != null) { listener.onSuccess(responseBody); } break; case REQUEST_FAIL: NetworkException e = (NetworkException) bundle.getSerializable(EXCEPTION_KEY); if (listener != null) { listener.onNetworkFail(e.getStatus(), e); } break; } } }; new Thread(new Runnable() { @Override public void run() { String responseBody = null; Message message = new Message(); try { responseBody = syncRequestGet(url); Bundle bundle = new Bundle(); bundle.putString(RESPONSE_KEY, responseBody); message = Message.obtain(handler, REQUEST_SUCCESS); message.setData(bundle); handler.sendMessage(message); } catch (NetworkException e) { Bundle bundle = new Bundle(); bundle.putSerializable(EXCEPTION_KEY, e); message = Message.obtain(handler, REQUEST_FAIL); message.setData(bundle); handler.sendMessage(message); e.printStackTrace(); } } }).start(); }
From source file:com.sunho.nating.fragments.DetailPlaceFragment.java
/** * Create a new instance of DetailFragment. * * @param resourceId The resource ID of the Drawable image to show * @param title The title of the image/* w w w. j a v a2 s.com*/ * @param x The horizontal position of the grid item in pixel * @param y The vertical position of the grid item in pixel * @param width The width of the grid item in pixel * @param height The height of the grid item in pixel * @return a new instance of DetailFragment */ public static DetailPlaceFragment newInstance(int resourceId, String title, int x, int y, int width, int height, int position, String locationLat, String locationLong) { myLocationLat = locationLat; myLocationLong = locationLong; intentPosition = position; DetailPlaceFragment fragment = new DetailPlaceFragment(); Bundle args = new Bundle(); args.putInt(ARG_RESOURCE_ID, resourceId); args.putString(ARG_TITLE, title); args.putInt(ARG_X, x); args.putInt(ARG_Y, y); args.putInt(ARG_WIDTH, width); args.putInt(ARG_HEIGHT, height); fragment.setArguments(args); return fragment; }
From source file:bolts.AppLinkNavigation.java
/** * Creates an AppLinkNavigation with the given link, extras, and App Link data. * * @param appLink the AppLink being navigated to. * @param extras the extras to include in the App Link navigation. * @param appLinkData additional App Link data for the navigation. *///ww w .j av a 2s .c o m public AppLinkNavigation(AppLink appLink, Bundle extras, Bundle appLinkData) { if (appLink == null) { throw new IllegalArgumentException("appLink must not be null."); } if (extras == null) { extras = new Bundle(); } if (appLinkData == null) { appLinkData = new Bundle(); } this.appLink = appLink; this.extras = extras; this.appLinkData = appLinkData; }
From source file:at.bitfire.davdroid.mirakel.syncadapter.LoginURLFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.next: FragmentTransaction ft = getFragmentManager().beginTransaction(); Bundle args = new Bundle(); String host_path = editBaseURI.getText().toString(); args.putString(QueryServerDialogFragment.EXTRA_BASE_URI, URLUtils.sanitize(scheme + host_path)); args.putString(QueryServerDialogFragment.EXTRA_USER_NAME, editUserName.getText().toString()); args.putString(QueryServerDialogFragment.EXTRA_PASSWORD, editPassword.getText().toString()); args.putBoolean(QueryServerDialogFragment.EXTRA_AUTH_PREEMPTIVE, checkboxPreemptive.isChecked()); DialogFragment dialog = new QueryServerDialogFragment(); dialog.setArguments(args);/*from w ww . ja v a 2s. c om*/ dialog.show(ft, QueryServerDialogFragment.class.getName()); break; default: return false; } return true; }
From source file:com.umeng.community.example.CommunityApplication.java
@Override public void onCreate() { super.onCreate(); PlatformConfig.setWeixin("wx96110a1e3af63a39", "c60e3d3ff109a5d17013df272df99199"); //RENREN????? //?// w w w . j a va 2 s. c o m PlatformConfig.setSinaWeibo("275392174", "d96fb6b323c60a42ed9f74bfab1b4f7a"); PlatformConfig.setQQZone("1104606393", "X4BAsJAVKtkDQ1zQ"); PushAgent.getInstance(this).setDebugMode(true); PushAgent.getInstance(this).setMessageHandler(new UmengMessageHandler() { @Override public void dealWithNotificationMessage(Context arg0, UMessage msg) { // ,???? super.dealWithNotificationMessage(arg0, msg); Log.e("", "### ???"); } }); PushAgent.getInstance(this).setNotificationClickHandler(new UHandler() { @Override public void handleMessage(Context context, UMessage uMessage) { com.umeng.comm.core.utils.Log.d("notifi", "getting message"); try { JSONObject jsonObject = uMessage.getRaw(); String feedid = ""; if (jsonObject != null) { com.umeng.comm.core.utils.Log.d("json", jsonObject.toString()); JSONObject extra = uMessage.getRaw().optJSONObject("extra"); feedid = extra.optString(Constants.FEED_ID); } Class myclass = Class.forName(uMessage.activity); Intent intent = new Intent(context, myclass); Bundle bundle = new Bundle(); bundle.putString(Constants.FEED_ID, feedid); intent.putExtras(bundle); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } catch (Exception e) { com.umeng.comm.core.utils.Log.d("class", e.getMessage()); } } }); }
From source file:edu.mit.mobile.android.locast.accounts.Authenticator.java
/** * {@inheritDoc}//from w ww . j a v a 2 s. com */ @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { if (options != null && options.containsKey(AccountManager.KEY_PASSWORD)) { final String password = options.getString(AccountManager.KEY_PASSWORD); final Bundle verified = onlineConfirmPassword(account, password); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, verified != null); return result; } // Launch AuthenticatorActivity to confirm credentials final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AuthenticatorActivity.EXTRA_CONFIRMCREDENTIALS, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.QuarkLabs.BTCeClient.fragments.HistoryFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDateFormat = android.text.format.DateFormat.getDateFormat(getActivity()); mHistoryType = (ListType) getArguments().getSerializable(mListTypeTag); mLoaderId = mHistoryType.ordinal();/* w w w. j a va 2 s . c om*/ //if we have StartDate and EndDate selected before if (savedInstanceState != null) { try { mStartDateValue = mDateFormat.parse(savedInstanceState.getString("startDate")); mEndDateValue = mDateFormat.parse(savedInstanceState.getString("endDate")); } catch (ParseException e) { e.printStackTrace(); } } else { Calendar calendar = Calendar.getInstance(); mStartDateValue = new Date(calendar.getTimeInMillis() - WEEK); mEndDateValue = new Date(calendar.getTimeInMillis()); } //creating bundle for loader Bundle bundle = new Bundle(); bundle.putString("startDate", String.valueOf(mStartDateValue.getTime() / 1000)); bundle.putString("endDate", String.valueOf(mEndDateValue.getTime() / 1000)); getLoaderManager().initLoader(mLoaderId, bundle, this); }
From source file:jp.alessandro.android.iab.ItemGetter.java
private Bundle createBundleItemListFromArray(ArrayList<String> itemIds) { Bundle bundle = new Bundle(); bundle.putStringArrayList(Constants.RESPONSE_ITEM_ID_LIST, itemIds); return bundle; }
From source file:com.openerp.services.MailGroupSyncService.java
public void performSync(Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { try {/*from w ww . j a v a 2 s .co m*/ Intent intent = new Intent(); intent.setAction(SyncFinishReceiver.SYNC_FINISH); MailGroupDB db = new MailGroupDB(context); db.setAccountUser(OpenERPAccountManager.getAccountDetail(context, account.name)); OEHelper oe = db.getOEInstance(); if (oe != null && oe.syncWithServer(true)) { MailFollowers followers = new MailFollowers(context); OEDomain domain = new OEDomain(); domain.add("partner_id", "=", oe.getUser().getPartner_id()); domain.add("res_model", "=", db.getModelName()); if (followers.getOEInstance().syncWithServer(domain, true)) { // syncing group messages JSONArray group_ids = new JSONArray(); for (OEDataRow grp : followers.select("res_model = ? AND partner_id = ?", new String[] { db.getModelName(), oe.getUser().getPartner_id() + "" })) { group_ids.put(grp.getInt("res_id")); } Bundle messageBundle = new Bundle(); messageBundle.putString("group_ids", group_ids.toString()); messageBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); messageBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(account, MessageProvider.AUTHORITY, messageBundle); } } if (OpenERPAccountManager.currentUser(context).getAndroidName().equals(account.name)) context.sendBroadcast(intent); } catch (Exception e) { e.printStackTrace(); } }
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.// w ww.ja v a2 s. c om */ 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; }