Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

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

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:de.uni_koblenz_landau.apow.EncounterDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.encounter_detail_fragment, container, false);

    // Create UI references.
    mDateDialog = (DateDialogFragment) getFragmentManager().findFragmentByTag(DATE_DIALOG_ID);
    if (mDateDialog != null) {
        mDateDialog.setListener(this);
    }//from  w w  w  . j a  v  a  2  s.c o  m
    mTimeDialog = (TimeDialogFragment) getFragmentManager().findFragmentByTag(TIME_DIALOG_ID);
    if (mTimeDialog != null) {
        mTimeDialog.setListener(this);
    }
    mDateView = (TextView) view.findViewById(R.id.encounter_detail_date);
    mTimeView = (TextView) view.findViewById(R.id.encounter_detail_time);
    mTypesView = (Spinner) view.findViewById(R.id.encounter_detail_types);

    // Restore UI from saved instance or load data.
    if (savedInstanceState != null) {
        mEncounter = (Encounter) savedInstanceState.getSerializable(ARG_ENCOUNTER);
        if (mEncounter != null) {
            mTypes = savedInstanceState.getParcelableArrayList(ARG_TYPES);
            ArrayAdapter<ListViewItem> adapter = new ArrayAdapter<>(getActivity(),
                    android.R.layout.simple_spinner_item, mTypes);
            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            mTypesView.setAdapter(adapter);
        }
    } else {
        loadEncounter();
    }

    return view;
}

From source file:com.androidquery.simplefeed.activity.PostActivity.java

@Override
protected void init(Bundle state) {

    Intent intent = getIntent();//from w  w  w  .j  a v a  2  s .  c  o  m

    String message = "";

    photo = (File) intent.getSerializableExtra("photo");
    message = intent.getStringExtra("message");

    if (state != null) {
        if (photo == null) {
            photo = (File) state.getSerializable("photo");
        }
        if (message == null) {
            message = state.getString("message");
        }
        location = state.getParcelable("location");
        place = (Place) state.getSerializable("place");
        tags = (List<Entity>) state.getSerializable("tags");
    }

    entity = (Entity) intent.getSerializableExtra("entity");
    item = (FeedItem) intent.getSerializableExtra("item");

    initView(message);

    albumCheck(0);
}

From source file:com.xunlei.shortvideo.activity.VideoPublishLocal3Activity.java

@Override
protected void initFromSaveInstance(Bundle savedInstance) {
    mVideo = (ShortVideo) savedInstance.getSerializable(EXTRA_SHORT_VIDEO);
    mProjectUri = (Uri) savedInstance.getParcelable(EXTRA_VIDEO_PROJECT);
    if (mVideo != null) {
        //            mVideoPath = mVideo.videoUrl;
    }// w  ww . j a v a2 s. c  o m
}

From source file:com.wmstein.transektcount.EditSectionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_edit_section);

    countNames = new ArrayList<>();
    countCodes = new ArrayList<>();
    countIds = new ArrayList<>();
    savedCounts = new ArrayList<>();

    notes_area = (LinearLayout) findViewById(R.id.editingNotesLayout);
    counts_area = (LinearLayout) findViewById(R.id.editingCountsLayout);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        section_id = extras.getInt("section_id");
    }//from www.  j a va  2s.c o  m

    /*
     * Restore any edit widgets the user has added previously
     */
    if (savedInstanceState != null) {
        if (savedInstanceState.getSerializable("savedCounts") != null) {
            savedCounts = (ArrayList<CountEditWidget>) savedInstanceState.getSerializable("savedCounts");
        }
    }

    // Load preferences
    transektCount = (TransektCountApplication) getApplication();
    prefs = TransektCountApplication.getPrefs();
    prefs.registerOnSharedPreferenceChangeListener(this);

    boolean brightPref = prefs.getBoolean("pref_bright", true);
    dupPref = prefs.getBoolean("pref_duplicate", true);

    // Set full brightness of screen
    if (brightPref) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.screenBrightness = 1.0f;
        getWindow().setAttributes(params);
    }

    ScrollView counting_screen = (ScrollView) findViewById(R.id.editingScreen);
    bMap = transektCount.decodeBitmap(R.drawable.kbackground, transektCount.width, transektCount.height);
    bg = new BitmapDrawable(counting_screen.getResources(), bMap);
    counting_screen.setBackground(bg);
}

From source file:com.eleybourn.bookcatalogue.utils.Utils.java

/**
 * Utility routine to get an author list from the intent extras
 * //from   www .  ja v a  2  s  . c om
 * @param i      Intent with author list
 * @return      List of authors
 */
@SuppressWarnings("unchecked")
public static ArrayList<Author> getAuthorsFromBundle(Bundle b) {
    return (ArrayList<Author>) b.getSerializable(CatalogueDBAdapter.KEY_AUTHOR_ARRAY);
}

From source file:com.eleybourn.bookcatalogue.utils.Utils.java

/**
 * Utility routine to get a series list from the intent extras
 * //from   w w w .  java 2 s .c om
 * @param i      Intent with series list
 * @return      List of series
 */
@SuppressWarnings("unchecked")
public static ArrayList<Series> getSeriesFromBundle(Bundle b) {
    return (ArrayList<Series>) b.getSerializable(CatalogueDBAdapter.KEY_SERIES_ARRAY);
}

From source file:com.cerema.cloud2.ui.activity.Uploader.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    prepareStreamsToUpload();/*from www.  ja v a  2  s .c  o m*/

    if (savedInstanceState == null) {
        mParents = new Stack<String>();
        mAccountSelected = false;
        mAccountSelectionShowing = false;
        mNumCacheFile = 0;

        // ArrayList for files with path in private storage
        mRemoteCacheData = new ArrayList<String>();
    } else {
        mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
        mFile = savedInstanceState.getParcelable(KEY_FILE);
        mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
        mAccountSelectionShowing = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTION_SHOWING);
        mNumCacheFile = savedInstanceState.getInt(KEY_NUM_CACHE_FILE);
        mRemoteCacheData = savedInstanceState.getStringArrayList(KEY_REMOTE_CACHE_DATA);
    }

    super.onCreate(savedInstanceState);

    if (mAccountSelected) {
        setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
    }

    // Listen for sync messages
    IntentFilter syncIntentFilter = new IntentFilter(
            RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
    syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
    mSyncBroadcastReceiver = new SyncBroadcastReceiver();
    registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
}

From source file:com.eleybourn.bookcatalogue.utils.Utils.java

/**
 * Utility routine to get the list from the passed bundle. Added to reduce lint warnings...
 * /*from  www .  jav  a 2 s .c om*/
 * @param b      Bundle containig list
 */
@SuppressWarnings("unchecked")
public static <T> ArrayList<T> getListFromBundle(Bundle b, String key) {
    return (ArrayList<T>) b.getSerializable(key);
}

From source file:com.tinfoil.sms.settings.ImportContacts.java

@SuppressWarnings("unchecked")
@Override/*from   w  w w .  j av a 2 s .  c o m*/
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.importcontacts);

    setupActionBar();

    this.importList = (ListView) this.findViewById(R.id.import_contact_list);

    if (savedInstanceState == null) {
        runTask = new ImportTask(this, false);
        runTask.execute(this);

        //final Thread thread = new Thread(this);
        this.dialog = ProgressDialog.show(this, this.getString(R.string.searching_title),
                this.getString(R.string.searching_message), true, true, new OnCancelListener() {

                    public void onCancel(DialogInterface dialog) {
                        runTask.cancel(true);
                        dialog.dismiss();
                        ImportContacts.this.finish();
                    }
                });
    } else {
        tc = (ArrayList<TrustedContact>) savedInstanceState.getSerializable(ImportContacts.TRUSTED_CONTACTS);
        inDb = (ArrayList<Boolean>) savedInstanceState.getSerializable(ImportContacts.IN_DATABASE);
        runTask = new ImportTask(this, true);
        runTask.execute(this);
        setUpUI();
    }

    this.importList.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            //Keep track of the contacts selected.
            if (!ImportContacts.this.disable) {
                ImportContacts.this.change(position);
            }
        }
    });
}

From source file:com.synox.android.ui.activity.Uploader.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    prepareStreamsToUpload();//from w w w . j  ava2s .c  om

    if (savedInstanceState == null) {
        mParents = new Stack<>();
        mAccountSelected = false;
        mAccountSelectionShowing = false;
        mNumCacheFile = 0;

        // ArrayList for files with path in private storage
        mRemoteCacheData = new ArrayList<>();
    } else {
        mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
        mFile = savedInstanceState.getParcelable(KEY_FILE);
        mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
        mAccountSelectionShowing = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTION_SHOWING);
        mNumCacheFile = savedInstanceState.getInt(KEY_NUM_CACHE_FILE);
        mRemoteCacheData = savedInstanceState.getStringArrayList(KEY_REMOTE_CACHE_DATA);
    }

    super.onCreate(savedInstanceState);

    if (mAccountSelected) {
        setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
    }

    // Listen for sync messages
    IntentFilter syncIntentFilter = new IntentFilter(
            RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
    syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
    mSyncBroadcastReceiver = new SyncBroadcastReceiver();
    registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
}