Example usage for android.os Bundle putParcelable

List of usage examples for android.os Bundle putParcelable

Introduction

In this page you can find the example usage for android.os Bundle putParcelable.

Prototype

public void putParcelable(@Nullable String key, @Nullable Parcelable value) 

Source Link

Document

Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.appsimobile.appsii.module.apps.ReorderAppsFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable("tag", mAppTag);
}

From source file:com.sonetel.plugins.sonetelcallthru.CallThru.java

@Override
public void onReceive(final Context context, Intent intent) {
    if (SipManager.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) {
        // Retrieve and cache infos from the phone app 
        if (!sPhoneAppInfoLoaded) {
            Resources r = context.getResources();
            BitmapDrawable drawable = (BitmapDrawable) r.getDrawable(R.drawable.ic_wizard_sonetel);
            sPhoneAppBmp = drawable.getBitmap();

            sPhoneAppInfoLoaded = true;/*  w  ww. j ava2 s  .  co m*/
        }

        Bundle results = getResultExtras(true);
        //if(pendingIntent != null) {
        //   results.putParcelable(CallHandlerPlugin.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
        //}
        results.putString(Intent.EXTRA_TITLE, "Call thru");// context.getResources().getString(R.string.use_pstn));
        if (sPhoneAppBmp != null) {
            results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, sPhoneAppBmp);
        }
        if (intent.getStringExtra(Intent.EXTRA_TEXT) == null)
            return;

        //final PendingIntent pendingIntent = null;
        final String callthrunum = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
        final String dialledNum = intent.getStringExtra(Intent.EXTRA_TEXT);
        // We must handle that clean way cause when call just to 
        // get the row in account list expect this to reply correctly
        if (callthrunum != null && PhoneCapabilityTester.isPhone(context)) {

            if (!callthrunum.equalsIgnoreCase("")) {
                DBAdapter dbAdapt = new DBAdapter(context);

                // Build pending intent

                SipAccount = dbAdapt.getAccount(1);

                if (SipAccount != null) {

                    Intent i = new Intent(Intent.ACTION_CALL);
                    i.setData(Uri.fromParts("tel", callthrunum, null));
                    final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i,
                            PendingIntent.FLAG_CANCEL_CURRENT);

                    NetWorkThread = new Thread() {
                        public void run() {
                            SendMsgToNetWork(dialledNum, context, pendingIntent);
                        };
                    };

                    NetWorkThread.start();

                }

                if (!dialledNum.equalsIgnoreCase("")) {
                    SipCallSessionImpl callInfo = new SipCallSessionImpl();

                    callInfo.setRemoteContact(dialledNum);
                    callInfo.setIncoming(false);
                    callInfo.callStart = System.currentTimeMillis();
                    callInfo.setAccId(3);
                    //callInfo.setLastStatusCode(pjsua.PJ_SUCCESS);

                    ContentValues cv = CallLogHelper.logValuesForCall(context, callInfo, callInfo.callStart);
                    context.getContentResolver().insert(SipManager.CALLLOG_URI, cv);

                }
            } else {
                Location_Finder LocFinder = new Location_Finder(context);
                if (LocFinder.getContryName().startsWith("your"))
                    Toast.makeText(context,
                            "Country of your current location unknown. Call thru not available.",
                            Toast.LENGTH_LONG).show();
                else
                    Toast.makeText(context,
                            "No Call thru access number available in " + LocFinder.getContryName(),
                            Toast.LENGTH_LONG).show();
                //Toast.makeText(context, "No Call thru access number available in ", Toast.LENGTH_LONG).show();
            }
        }

        // This will exclude next time tel:xxx is raised from csipsimple treatment which is wanted
        results.putString(Intent.EXTRA_PHONE_NUMBER, callthrunum);

    }

}

From source file:com.android.contacts.activities.PhotoSelectionActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable(KEY_CURRENT_PHOTO_URI, mCurrentPhotoUri);
    outState.putBoolean(KEY_SUB_ACTIVITY_IN_PROGRESS, mSubActivityInProgress);
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.ThreadViewFragment.java

/**
 * Set up and launch the postCommentFragment when the user wishes to reply
 * to a comment. The fragment takes as input the index of the thread and the
 * comment object to reply to./*w ww .  j a v a2  s.c om*/
 * 
 * @param comment The Comment being replied to.
 * @param threadIndex The index of the ThreadComment where the reply is taking place.
 */
public void replyToComment(Comment comment, int threadIndex) {
    Fragment fragment = new PostFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable("cmt", comment);
    bundle.putLong("id", threadIndex);
    fragment.setArguments(bundle);
    boolean fromFavs = false;
    Fragment fav = getFragmentManager().findFragmentByTag("favThrFragment");
    if (fav != null) {
        fromFavs = true;
    }
    bundle.putBoolean("fromFavs", fromFavs);
    getFragmentManager().beginTransaction().replace(container, fragment, "postFrag").addToBackStack(null)
            .commit();
    getFragmentManager().executePendingTransactions();
}

From source file:com.yschi.castscreen.MainActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mResultData != null) {
        outState.putInt(STATE_RESULT_CODE, mResultCode);
        outState.putParcelable(STATE_RESULT_DATA, mResultData);
    }//from  w  w  w .  j  a  v  a  2 s .co m
}

From source file:com.appsimobile.appsii.module.weather.WeatherActivity.java

@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable("selected_image", mBitmap);
}

From source file:com.android.deskclock.RingtonePickerDialogFragment.java

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putBoolean(STATE_KEY_REQUESTING_PERMISSION, mRequestingPermission);
    outState.putParcelable(STATE_KEY_SELECTED_RINGTONE_URI, mSelectedRingtoneUri);
}

From source file:org.bwgz.quotation.activity.QuotationActivity.java

private void initLoaders(LoaderManager loaderManager, Uri uri) {
    Bundle bundle = new Bundle();
    bundle.putParcelable(LOAD_URI, uri);

    for (int id : LOADER_IDS) {
        initLoader(loaderManager, id, bundle, this);
    }/*from   w w w.  j  a  v  a 2s  . co m*/
}

From source file:co.codecrunch.musicplayerlite.recyclerviewutils.ItemSelectionSupport.java

public Bundle onSaveInstanceState() {
    final Bundle state = new Bundle();

    state.putInt(STATE_KEY_CHOICE_MODE, mChoiceMode.ordinal());
    state.putParcelable(STATE_KEY_CHECKED_STATES, mCheckedStates);
    state.putParcelable(STATE_KEY_CHECKED_ID_STATES, mCheckedIdStates);
    state.putInt(STATE_KEY_CHECKED_COUNT, mCheckedCount);

    return state;
}

From source file:com.ayuget.redface.ui.activity.TopicsActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (currentCategory != null) {
        outState.putParcelable(ARG_CURRENT_CATEGORY, currentCategory);
    }//  ww w  .  j a  v a2s  .c  o  m
}