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:com.sdrtouch.tools.DeviceDialog.java

@Override
@NonNull/*from  w ww  .  j  a v a  2 s  . com*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final OnDeviceDialog callback = (OnDeviceDialog) getActivity();
    final Bundle b = getArguments();
    final int devicesCount = b.getInt(SDR_DEVICES_COUNT);
    final SdrDevice[] devices = new SdrDevice[devicesCount];
    final String[] options = new String[devicesCount];
    for (int id = 0; id < devicesCount; id++) {
        SdrDevice sdrDevice = (SdrDevice) Check.isNotNull(b.getSerializable(String.format(SDR_DEVICE, id)));
        devices[id] = sdrDevice;
        options[id] = sdrDevice.getName();
    }

    return new AlertDialog.Builder(getActivity()).setItems(options, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final SdrDevice selected = devices[which];
            callback.onDeviceDialogDeviceChosen(selected);
        }
    }).setTitle(R.string.choose_device).create();
}

From source file:augsburg.se.alltagsguide.utilities.ui.BasePageWebViewLanguageActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    mTranslatedDismissed = savedInstanceState.getBoolean(TRANSLATED_DISMISSED);
    Serializable savedInstance = savedInstanceState.getSerializable(PAGE_STATE);
    setPageFromSerializable(savedInstance);
}

From source file:com.by_syk.lib.nanoiconpack.dialog.IconDialog.java

@NonNull
@Override/* w w w .ja  v a  2 s .  c  om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View viewContent = getActivity().getLayoutInflater().inflate(R.layout.dialog_icon, null);

    initView(viewContent);

    AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).setView(viewContent);

    Bundle bundle = getArguments();
    if (bundle != null) {
        iconBean = (IconBean) bundle.getSerializable("bean");
        if (iconBean != null) {
            builder.setTitle(getTitle(iconBean));
            //                ivIcon.setImageResource(iconBean.getId());
            int hdIconId = getResources().getIdentifier(iconBean.getName(), "mipmap",
                    getContext().getPackageName());
            ivIcon.setImageResource(hdIconId != 0 ? hdIconId : iconBean.getId());
            viewActionSave.setVisibility(iconBean.getId() != 0 || hdIconId != 0 ? View.VISIBLE : View.GONE);
            viewActionSend2Home.setVisibility(iconBean.containsInstalledComponent() ? View.VISIBLE : View.GONE);
        }
        if (bundle.getBoolean("pick")) {
            viewActionSave.setVisibility(View.GONE);
            viewActionSend2Home.setVisibility(View.GONE);
            viewActionChoose.setVisibility(View.VISIBLE);
        }
    }

    return builder.create();
}

From source file:com.gh4a.activities.ReleaseInfoActivity.java

@Override
protected void onInitExtras(Bundle extras) {
    super.onInitExtras(extras);
    mRepoOwner = extras.getString(Constants.Repository.OWNER);
    mRepoName = extras.getString(Constants.Repository.NAME);
    mRelease = (Release) extras.getSerializable(Constants.Release.RELEASE);
    mReleaseId = extras.getLong(Constants.Release.ID);
}

From source file:com.cmput301.classproject.UI.ViewTaskActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_task);
    getActionBar().setDisplayHomeAsUpEnabled(false);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        this.task = (Task) extras.getSerializable("Task");
    }/*  w  w  w  . jav  a2s  .  c  om*/

    if (task == null) {
        finish();
    } else {
        taskId = task.getId();
        TaskManager.currentTask = task.getId();
        TextView temp;

        // TODO make this view look better
        temp = ((TextView) findViewById(R.id.task_view_name));
        temp.setText(task.getName());

        temp = ((TextView) findViewById(R.id.task_view_description));
        temp.setText(task.getDescription());

        temp = ((TextView) findViewById(R.id.task_view_creator));
        temp.setText(task.getCreator());

        temp = ((TextView) findViewById(R.id.task_view_requires));
        String requires = requires();
        temp.setText(requires);

        temp = ((TextView) findViewById(R.id.task_view_access));
        if (task.isPublicAccess())
            temp.setText("Public");
        else
            temp.setText("Private");

    }

    final ViewTaskActivity selfRef = this;

    submissionListView = (ListView) findViewById(R.id.task_view_submission_list);
    submissionListView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    submissionListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    submissionListView.setStackFromBottom(false);
    submissionListView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Submission submission = (Submission) submissionListView.getItemAtPosition(position);
            if (submission != null) {
                Intent intent = new Intent(selfRef, SubmissionViewActivity.class);
                intent.putExtra("Submission", submission);
                startActivity(intent);
            }

        }
    });

    submissionViewAdapter2 = new FilteredSubmissionArray(this, android.R.layout.simple_list_item_activated_1,
            android.R.id.text1, submissionArray);
    submissionViewAdapter2.setNotifyOnChange(true);
    submissionListView.setAdapter(submissionViewAdapter2);

    // MVC model attach this view to our data model
    TaskManager.getInstance().addObserver(this);

    for (Submission s : task.getSubmissions()) {
        addSubmission(task, s);
    }
    submissionViewAdapter2.notifyDataSetChanged();

    if (task.getSubmissions().size() == 0) {
        ApplicationCore.displayToastMessageLong(this, getString(R.string.view_task_no_submission_msg));
    }
}

From source file:com.nbossard.packlist.gui.TripDetailFragment.java

/**
 * During creation, if arguments have been supplied to the fragment
 * then parse those out./* www . j  av a 2s.c  om*/
 */
@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mIMainActivity = (IMainActivity) getActivity();

    Bundle args = getArguments();
    if (args != null) {
        mRetrievedTrip = (Trip) args.getSerializable(BUNDLE_PAR_TRIP_ID);
    }

}

From source file:fi.mikuz.boarder.gui.internet.Favorites.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("Favorite Uploads");
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    setContentView(R.layout.internet_uploads_list);

    mList = new ArrayList<InternetVersionBoard>();
    mListView = (ListView) findViewById(android.R.id.list);
    mMaxResults = 40;/*from   w  w w.ja va 2  s .  c  om*/

    mWaitDialog = new TimeoutProgressDialog(Favorites.this, "Waiting for response", TAG, true);

    Bundle extras = getIntent().getExtras();
    @SuppressWarnings("unchecked")
    HashMap<String, String> lastSession = (HashMap<String, String>) extras
            .getSerializable(InternetMenu.LOGIN_KEY);

    try {
        mUserId = lastSession.get(InternetMenu.USER_ID_KEY);
        mSessionToken = lastSession.get(InternetMenu.SESSION_TOKEN_KEY);

        refreshList();
        getListView().setOnScrollListener(this);
    } catch (NullPointerException e) {
        Toast.makeText(Favorites.this, "Please login", Toast.LENGTH_LONG).show();
        Favorites.this.finish();
    }

}

From source file:com.andrada.sitracker.tasks.ImportAuthorsTask.java

private void setupExtras(@NotNull Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras != null) {
        if (extras.containsKey(AUTHOR_LIST_EXTRA)) {
            authorsList = (List<String>) extras.getSerializable(AUTHOR_LIST_EXTRA);
        }/*from   w w  w  . j  a v  a 2  s  .c  om*/
    }
}

From source file:de.schildbach.wallet.ui.send.RaiseFeeDialogFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    viewModel = ViewModelProviders.of(this).get(ViewModel.class);
    viewModel.getDynamicFees().observe(this, new Observer<Map<FeeCategory, Coin>>() {
        @Override/*from   w w  w  . ja v  a2 s . c o  m*/
        public void onChanged(final Map<FeeCategory, Coin> dynamicFees) {
            // We basically have to pay fee for two transactions:
            // The transaction to raise the fee of and the CPFP transaction we're about to create.
            final int size = transaction.getMessageSize() + 192;
            feeRaise = dynamicFees.get(FeeCategory.PRIORITY).multiply(size).divide(1000);
            updateView();
        }
    });

    final Bundle args = getArguments();
    final byte[] txHash = (byte[]) args.getSerializable(KEY_TRANSACTION);
    transaction = checkNotNull(wallet.getTransaction(Sha256Hash.wrap(txHash)));

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());
}

From source file:com.mingbai.library.ContactListFragment.java

@SuppressWarnings("unchecked")
@Override/* w  w w. ja va  2  s. c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (savedInstanceState != null) {
        results = (Hashtable<String, ContactResult>) savedInstanceState.getSerializable(SAVE_STATE_KEY);
    }

    View rootView = inflater.inflate(R.layout.contact_list_fragment, container);

    mContactListView = (ListView) rootView.findViewById(R.id.contactListView);

    mContactListView.setAdapter(mCursorAdapter);
    mContactListView.setOnItemClickListener(this);

    /*inputSearch = (EditText) rootView.findViewById(R.id.inputSearch);
    inputSearch.addTextChangedListener(new TextWatcher() {
               
       @Override
       public void onTextChanged(CharSequence s, int start, int before, int count) {
    // TODO Auto-generated method stub
    mCursorAdapter.notifyDataSetChanged();
    mCursorAdapter.getFilter().filter(s);
    mContactListView.setAdapter(mCursorAdapter);
       }
               
       @Override
       public void beforeTextChanged(CharSequence s, int start, int count,
       int after) {
    // TODO Auto-generated method stub
            
       }
               
       @Override
       public void afterTextChanged(Editable s) {
    // TODO Auto-generated method stub
            
       }
    });*/

    return rootView;
}