List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:co.nerdart.ourss.activity.EntriesListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); Intent intent = getIntent();//from w ww . ja v a2s . c o m long feedId = intent.getLongExtra(FeedColumns._ID, 0); String title = null; if (feedId > 0) { Cursor cursor = getContentResolver().query(FeedColumns.CONTENT_URI(feedId), FEED_PROJECTION, null, null, null); if (cursor.moveToFirst()) { title = cursor.isNull(0) ? cursor.getString(1) : cursor.getString(0); iconBytes = cursor.getBlob(2); } cursor.close(); } if (title != null) { setTitle(title); } if (savedInstanceState == null) { EntriesListFragment fragment = new EntriesListFragment(); Bundle args = new Bundle(); args.putParcelable(EntriesListFragment.ARG_URI, intent.getData()); fragment.setArguments(args); fragment.setHasOptionsMenu(true); getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment, "fragment").commit(); } if (iconBytes != null && iconBytes.length > 0) { int bitmapSizeInDip = UiUtils.dpToPixel(24); Bitmap bitmap = BitmapFactory.decodeByteArray(iconBytes, 0, iconBytes.length); if (bitmap != null) { if (bitmap.getHeight() != bitmapSizeInDip) { bitmap = Bitmap.createScaledBitmap(bitmap, bitmapSizeInDip, bitmapSizeInDip, false); } getActionBar().setIcon(new BitmapDrawable(getResources(), bitmap)); } } if (MainActivity.mNotificationManager == null) { MainActivity.mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); } }
From source file:co.paulburke.android.textviewpager.TextViewPager.java
@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); // Keep tabs of the current page offset, since the number of lines will // change with configurations int offset = mPagerAdapter.getOffsetForPosition(getCurrentItem()); bundle.putInt(STATE_OFFSET, offset); return bundle; }
From source file:eu.masconsult.bgbanking.accounts.AccountAuthenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Log.v(TAG, "addAccount(type: " + accountType + ", authTokenType: " + authTokenType + ")"); final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(KEY_ACCOUNT_TYPE, accountType); final Bundle bundle = new Bundle(); bundle.putParcelable(KEY_INTENT, intent); return bundle; }
From source file:com.scrachx.foodfacts.checker.ui.history.HistoryFragment.java
@Override public void openPageProduct(State stateProduct) { Bundle args = new Bundle(); args.putParcelable("state", stateProduct); startActivity(ProductActivity.getStartIntent(this.getActivity(), args)); }
From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java
@Override public Parcelable onSaveInstanceState() { final Bundle state = new Bundle(); state.putParcelable("super_state", super.onSaveInstanceState()); state.putInt("page_position", pagePosition); state.putFloat("page_offset", pageOffset); return state; }
From source file:ar.com.martineo14.spotifystreamer2.ui.fragment.ArtistDetailActivityFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (listView != null) { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/* w w w.j av a2s.com*/ public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { TrackModel track = tracksListAdapter.getItem(position); if (track != null) { TrackModel trackModel = new TrackModel(mArtistIDStr, mArtistNameSrt, track.artistAlbum, track.albumImageBig, track.albumImageSmall, track.trackId, track.trackName, track.trackPreview, position); Bundle bundle = new Bundle(); bundle.putParcelable(Constants.TRACK_MODEL, trackModel); TrackPlayerActivityFragment playerActivityFragment = new TrackPlayerActivityFragment(); playerActivityFragment.setArguments(bundle); playerActivityFragment.show(getFragmentManager(), "dialog"); } } }); } }
From source file:net.naonedbus.card.impl.TraficCard.java
private View createView(final LayoutInflater inflater, final ViewGroup root, final InfoTrafic infoTrafic) { final View view = inflater.inflate(R.layout.card_item_trafic_ligne, root, false); final TextView itemTitle = (TextView) view.findViewById(R.id.itemTitle); final TextView itemDate = (TextView) view.findViewById(R.id.itemDate); itemTitle.setText(infoTrafic.getIntitule()); itemDate.setText(infoTrafic.getDateFormated()); if (isCurrent(infoTrafic)) { itemDate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.info_trafic_on, 0, 0, 0); } else {//from w w w . j ava2 s. co m itemDate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.info_trafic_off, 0, 0, 0); } view.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Bundle bundle = new Bundle(); bundle.putParcelable(InfoTraficDetailFragment.PARAM_INFO_TRAFIC, infoTrafic); final DialogFragment dialogFragment = new InfoTraficDetailDialogFragment(); dialogFragment.setArguments(bundle); dialogFragment.show(getFragmentManager(), "InfoTraficDetailDialogFragment"); } }); return view; }
From source file:com.clearcenter.mobile_demo.mdAuthenticator.java
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) throws NetworkErrorException { Log.v(TAG, "getAuthToken()"); // If the caller requested an authToken type we don't support, then // return an error if (!authTokenType.equals(mdConstants.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }// w w w . j a va2s.c o m // Extract the username and password from the Account Manager, and ask // the server for an appropriate AuthToken. final AccountManager am = AccountManager.get(ctx); final String password = am.getPassword(account); final String hostname = am.getUserData(account, "hostname"); final String username = am.getUserData(account, "username"); if (password != null) { try { mdSSLUtil.DisableSecurity(); final String authToken = mdRest.Login(hostname, username, null, password); if (!TextUtils.isEmpty(authToken)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, mdConstants.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } } catch (JSONException e) { Log.e(TAG, "JSONException", e); } catch (GeneralSecurityException e) { Log.e(TAG, "GeneralSecurityException", e); } } Log.v(TAG, "Asking for password again..."); // If we get here, then we couldn't access the user's password - so we // need to re-prompt them for their credentials. We do that by creating // an intent to display our mdAuthenticatorActivity panel. final Intent intent = new Intent(ctx, mdAuthenticatorActivity.class); intent.putExtra(mdAuthenticatorActivity.PARAM_NICKNAME, account.name); intent.putExtra(mdAuthenticatorActivity.PARAM_USERNAME, username); intent.putExtra(mdAuthenticatorActivity.PARAM_HOSTNAME, hostname); intent.putExtra(mdAuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(mdAuthenticatorActivity.PARAM_CONFIRM_CREDENTIALS, 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.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; }/*from w w w . j av a2 s. c o m*/ 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.actinarium.nagbox.ui.EditTaskDialogFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(ARG_TASK, mTask); }