List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:com.seregil13.literarytracker.lightnovel.LightNovelEditFragment.java
/** * Creates a new instance of the fragment in create mode with all the pertinent data passed in as * parameters.// w w w . j av a2 s .co m * * @return An instance of LightNovelEditFragment. */ public static LightNovelEditFragment newCreateInstance() { LightNovelEditFragment fragment = new LightNovelEditFragment(); Bundle arguments = new Bundle(); arguments.putSerializable(CREATE_OR_EDIT_KEY, Mode.CREATE); fragment.setArguments(arguments); return fragment; }
From source file:com.gmail.at.faint545.fragments.QueueFragment.java
public static QueueFragment newInstance(Remote mRemote) { QueueFragment self = new QueueFragment(); Bundle args = new Bundle(); args.putParcelable("remote", mRemote); self.setArguments(args);//from w ww. jav a 2s.c o m return self; }
From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardClient.java
/** * Send an authenticated GetApplications request asynchronously and return its results to the given callback. *//*from w w w. j a v a 2 s. c o m*/ public void executeGetApplications(final PostExecuteCallback postGetApplicationsCallback) { new AuthenticatedRequestTask("https://appengine.google.com/", new AuthenticatedRequestTaskBackgroundCallback() { @Override public Bundle run(final HttpEntity httpResponse) { Bundle result = new Bundle(); try { mLastRetrievedApplications = AppEngineParserUtils .getApplicationIDs(httpResponse.getContent()); result.putStringArrayList(KEY_APPLICATIONS, mLastRetrievedApplications); result.putBoolean(KEY_RESULT, true); } catch (IOException e) { LogUtils.e("AppEngineDashboardClient", "Failed parsing the GetApplications response", e); result.putBoolean(KEY_RESULT, false); } return result; } }, postGetApplicationsCallback).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); }
From source file:com.manning.androidhacks.hack023.authenticator.Authenticator.java
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { if (!authTokenType.equals(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }/*w w w . ja v a 2 s. com*/ final AccountManager am = AccountManager.get(mContext); final String password = am.getPassword(account); if (password != null) { boolean verified = false; String loginResponse = null; try { loginResponse = LoginServiceImpl.sendCredentials(account.name, password); verified = LoginServiceImpl.hasLoggedIn(loginResponse); } catch (AndroidHacksException e) { verified = false; } if (verified) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, AuthenticatorActivity.PARAM_ACCOUNT_TYPE); return result; } } // Password is missing or incorrect final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.PARAM_USER, account.name); intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); 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.comu.android.StreamJsHandler.java
/** * Like or unlike a post//from w w w . j a v a2s . c om * * @param post_id * @param val if the action should be a like (true) or an unlike (false) */ public void like(final String post_id, final boolean val) { Bundle params = new Bundle(); if (!val) { params.putString("method", "delete"); } getFb().request(post_id + "/likes", new Bundle(), "POST", new AsyncRequestListener() { public void onComplete(JSONObject response, final Object state) { callJs("javascript:onLike('" + post_id + "'," + val + ")"); } }, null); }
From source file:com.example.android.fragments.MainActivity.java
public void onArticleSelected(int position) { // The user selected the headline of an article from the HeadlinesFragment // Capture the article fragment from the activity layout ArticlesFragment articleFrag = (ArticlesFragment) getSupportFragmentManager() .findFragmentById(R.id.article_fragment); if (articleFrag != null) { // If article frag is available, we're in two-pane layout... // Call a method in the ArticleFragment to update its content articleFrag.updateArticleView(position); } else {//from w ww . j a v a 2s. c o m // If the frag is not available, we're in the one-pane layout and must swap frags... // Create fragment and give it an argument for the selected article ArticlesFragment newFragment = new ArticlesFragment(); Bundle args = new Bundle(); args.putInt(ArticlesFragment.ARG_POSITION, position); newFragment.setArguments(args); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack so the user can navigate back transaction.replace(R.id.fragment_container, newFragment); transaction.addToBackStack(null); // Commit the transaction transaction.commit(); } }
From source file:at.bitfire.davdroid.mirakel.syncadapter.EnterCredentialsFragment.java
void queryServer() { FragmentTransaction ft = getFragmentManager().beginTransaction(); Bundle args = new Bundle(); String host_path = editBaseURL.getText().toString(); args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, URIUtils.sanitize(protocol + 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);/* ww w . j a v a2s. c om*/ dialog.show(ft, QueryServerDialogFragment.class.getName()); }
From source file:com.facebook.notifications.internal.appevents.AppEventsLogger.java
private void logEvent(@NonNull String eventName, @Nullable String campaignIdentifier) { if (campaignIdentifier == null || campaignIdentifier.equals("") || fbSDKLogger == null || fbSDKLogMethod == null) { return;/*from www . java2 s . co m*/ } Bundle parameters = new Bundle(); parameters.putString(PUSH_CAMPAIGN_KEY, campaignIdentifier); try { fbSDKLogMethod.invoke(fbSDKLogger, eventName, parameters); } catch (Exception ex) { Log.w(LOG_TAG, "Failed to invoke AppEventsLogger." + "Did you forget to include the Facebook SDK in your application?", ex); } }
From source file:com.galois.qrstream.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setupUI();//from w ww. j a v a 2 s .com hideUI(); fragmentManager = getFragmentManager(); transmitFragment = new TransmitFragment(); receiveFragment = new ReceiveFragment(); settingsFragment = new SettingsFragment(); // Load application's default settings before user opens settings // screen because we want Rx and Tx to run with defaults. PreferenceManager.setDefaultValues(this, com.galois.qrstream.lib.R.xml.settings, false); if (savedInstanceState == null) { Intent startingIntent = getIntent(); Log.d(Constants.APP_TAG, "startingIntent " + startingIntent.getAction()); if (startingIntent.getAction().equals(Intent.ACTION_SEND)) { try { Job job = buildJobFromIntent(startingIntent); Bundle bundle = new Bundle(); bundle.putSerializable("job", job); transmitFragment.setArguments(bundle); showFragment(transmitFragment); } catch (IllegalArgumentException e) { Toast.makeText(this, "Unsupported media type.", Toast.LENGTH_LONG).show(); finish(); } } else { showFragment(receiveFragment); } } }
From source file:com.zd.vpn.fragments.AboutFragment.java
private void initGMSDonateOptions() { try {//from www. j a va 2 s. co m int billingSupported = mService.isBillingSupported(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP); if (billingSupported != BILLING_RESPONSE_RESULT_OK) { Log.i("OpenVPN", "Play store billing not supported"); return; } ArrayList skuList = new ArrayList(); Collections.addAll(skuList, donationSkus); Bundle querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); Bundle ownedItems = mService.getPurchases(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP, null); if (ownedItems.getInt(RESPONSE_CODE) != BILLING_RESPONSE_RESULT_OK) return; final ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); Bundle skuDetails = mService.getSkuDetails(3, getActivity().getPackageName(), INAPPITEM_TYPE_INAPP, querySkus); if (skuDetails.getInt(RESPONSE_CODE) != BILLING_RESPONSE_RESULT_OK) return; final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST"); if (getActivity() != null) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { createPlayBuyOptions(ownedSkus, responseList); } }); } } catch (RemoteException e) { VpnStatus.logException(e); } }