Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

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

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

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

Usage

From source file:com.tassadar.multirommgr.installfragment.InstallCard.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.install_btn: {
        Bundle extras = new Bundle();

        Bundle bundle = new Bundle();
        bundle.putString("installation_type", "multirom");

        CheckBox b = (CheckBox) m_view.findViewById(R.id.install_multirom);
        bundle.putBoolean("install_multirom", b.isChecked());

        b = (CheckBox) m_view.findViewById(R.id.install_recovery);
        bundle.putBoolean("install_recovery", b.isChecked());

        b = (CheckBox) m_view.findViewById(R.id.install_kernel);
        bundle.putBoolean("install_kernel", b.isChecked());

        if (b.isChecked()) {
            Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options);
            String name = (String) s.getAdapter().getItem(s.getSelectedItemPosition());
            bundle.putString("kernel_name", name);
        }/*from   w w w . j a  va 2s  .com*/

        extras.putBundle("installation_info", bundle);

        m_listener.startActivity(extras, MainActivity.ACT_INSTALL_MULTIROM, InstallActivity.class);
        break;
    }
    case R.id.changelog_btn: {
        Changelog[] logs = m_manifest.getChangelogs();
        String[] names = new String[logs.length];
        String[] urls = new String[logs.length];

        for (int i = 0; i < logs.length; ++i) {
            names[i] = logs[i].name;
            urls[i] = logs[i].url;
        }

        Bundle b = new Bundle();
        b.putStringArray("changelog_names", names);
        b.putStringArray("changelog_urls", urls);

        m_listener.startActivity(b, MainActivity.ACT_CHANGELOG, ChangelogActivity.class);
        break;
    }
    }
}

From source file:com.ryan.ryanreader.activities.PostSubmitActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("post_title", titleEdit.getText().toString());
    outState.putString("post_body", textEdit.getText().toString());
    outState.putString("subreddit", subredditEdit.getText().toString());
    outState.putInt("post_type", typeSpinner.getSelectedItemPosition());
}

From source file:edu.mit.media.funf.wifiscanner.MainPipeline.java

@Override
public void onDataReceived(Bundle data) {
    String android_id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID);
    data.putString("Device_ID", android_id);

    super.onDataReceived(data);

    if (MainActivity.real_time) {

        data.putString("WoTK_ID", "coffeejack"); //add WotKit info here
        String dataJson = getBundleSerializer().serialize(data);

        new RequestTask().execute(MainActivity.REAL_TIME_UPLOAD_URL, dataJson);
    }/*from  w w  w  .  ja  v a  2  s .  c  o m*/

    incrementCount();
}

From source file:net.healeys.lexic.online.OnlineGame.java

public void save(Bundle bun) {
    super.save(bun);

    bun.putString("uri", uri);
    bun.putString("words_url", urls.get("words"));
    bun.putString("score_url", urls.get("score"));

}

From source file:com.cw.litenote.operation.import_export.Import_filesList.java

public void onListItemClick(long rowId) {
    selectedRow = (int) rowId;
    if (selectedRow == 0) {
        //root/*w w w  . ja va 2 s. co  m*/
        getFiles(new File("/").listFiles());
    } else {
        currFilePath = filePathArray.get(selectedRow);
        final File file = new File(currFilePath);
        if (file.isDirectory()) {
            //directory
            getFiles(file.listFiles());
        } else {
            // view the selected file's content
            if (file.isFile() && (file.getName().contains("XML") || file.getName().contains("xml"))) {
                View view1 = getActivity().findViewById(R.id.view_back_btn_bg);
                view1.setVisibility(View.GONE);
                View view2 = getActivity().findViewById(R.id.file_list_title);
                view2.setVisibility(View.GONE);

                Import_fileView fragment = new Import_fileView();
                final Bundle args = new Bundle();
                args.putString("KEY_FILE_PATH", currFilePath);
                fragment.setArguments(args);
                FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
                transaction.setCustomAnimations(R.anim.fragment_slide_in_left, R.anim.fragment_slide_out_left,
                        R.anim.fragment_slide_in_right, R.anim.fragment_slide_out_right);
                transaction.replace(R.id.file_list_linear, fragment, "import_view").addToBackStack(null)
                        .commit();
            } else {
                Toast.makeText(getActivity(), R.string.file_not_found, Toast.LENGTH_SHORT).show();
                String dirString = new File(currFilePath).getParent();
                File dir = new File(dirString);
                getFiles(dir.listFiles());
            }
        }
    }
}

From source file:com.QuarkLabs.BTCeClient.fragments.HistoryFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mAdapter = new OrdersAdapter(getActivity(), mHistoryType);
    mListView = (ListView) getView().findViewById(R.id.HistoryContainer);
    final EditText startDate = (EditText) getView().findViewById(R.id.StartDateValue);
    final EditText endDate = (EditText) getView().findViewById(R.id.EndDateValue);
    startDate.setText(mDateFormat.format(mStartDateValue));
    endDate.setText(mDateFormat.format(mEndDateValue));
    Button makeQuery = (Button) getView().findViewById(R.id.MakeQueryButton);
    View.OnClickListener showDatePicker = new View.OnClickListener() {
        @Override/* w  ww  . java 2  s . co  m*/
        public void onClick(View v) {
            final TextView dateValue = (TextView) v;
            Date date = null;
            try {
                date = mDateFormat.parse(dateValue.getText().toString());
            } catch (ParseException e) {
                e.printStackTrace();
            }
            int year = 1999;
            int month = 0;
            int day = 1;
            if (date != null) {
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(date);
                year = calendar.get(Calendar.YEAR);
                month = calendar.get(Calendar.MONTH);
                day = calendar.get(Calendar.DAY_OF_MONTH);
            }

            DatePickerDialog datePickerDialog = new android.app.DatePickerDialog(getActivity(),
                    new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                            Calendar calendar = Calendar.getInstance();
                            if (dateValue.getId() == R.id.StartDateValue) {
                                calendar.setTime(mStartDateValue);
                                calendar.set(year, monthOfYear, dayOfMonth, 0, 0, 0);
                                mStartDateValue = calendar.getTime();
                            } else {
                                calendar.setTime(mEndDateValue);
                                calendar.set(year, monthOfYear, dayOfMonth, 23, 59, 59);
                                mEndDateValue = calendar.getTime();
                            }
                            dateValue.setText(mDateFormat.format(calendar.getTime()));
                        }
                    }, year, month, day);
            datePickerDialog.getDatePicker().setCalendarViewShown(false);
            datePickerDialog.show();
        }
    };
    startDate.setOnClickListener(showDatePicker);
    endDate.setOnClickListener(showDatePicker);
    makeQuery.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Bundle bundle = new Bundle();
            bundle.putString("startDate", String.valueOf(mStartDateValue.getTime() / 1000));
            bundle.putString("endDate", String.valueOf(mEndDateValue.getTime() / 1000));
            getLoaderManager().restartLoader(mLoaderId, bundle, HistoryFragment.this);
            mListView.setAdapter(null);
            mNoItems.setVisibility(View.GONE);
            mListView.setEmptyView(mLoadingView);

        }
    });
    mLoadingView = (ProgressBar) getView().findViewById(R.id.Loading);
    mNoItems = (TextView) getView().findViewById(R.id.NoItems);
    mListView.setEmptyView(mLoadingView);
}

From source file:com.google.android.apps.iosched.service.SyncService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")");

    final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
    if (receiver != null)
        receiver.send(STATUS_RUNNING, Bundle.EMPTY);

    final Context context = this;
    final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE);
    final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION, VERSION_NONE);

    try {/*from   ww w  .ja va  2 s.co m*/
        // Bulk of sync work, performed by executing several fetches from
        // local and online sources.

        final long startLocal = System.currentTimeMillis();
        final boolean localParse = localVersion < VERSION_CURRENT;
        Log.d(TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT);
        if (localParse) {
            // Load static local data
            mLocalExecutor.execute(R.xml.blocks, new LocalBlocksHandler());
            mLocalExecutor.execute(R.xml.rooms, new LocalRoomsHandler());
            mLocalExecutor.execute(R.xml.tracks, new LocalTracksHandler());
            mLocalExecutor.execute(R.xml.search_suggest, new LocalSearchSuggestHandler());
            mLocalExecutor.execute(R.xml.sessions, new LocalSessionsHandler());

            // Parse values from local cache first, since spreadsheet copy
            // or network might be down.
            mLocalExecutor.execute(context, "cache-sessions.xml", new RemoteSessionsHandler());
            mLocalExecutor.execute(context, "cache-speakers.xml", new RemoteSpeakersHandler());
            mLocalExecutor.execute(context, "cache-vendors.xml", new RemoteVendorsHandler());

            // Save local parsed version
            prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit();
        }
        Log.d(TAG, "local sync took " + (System.currentTimeMillis() - startLocal) + "ms");

        // Always hit remote spreadsheet for any updates
        final long startRemote = System.currentTimeMillis();
        mRemoteExecutor.executeGet(WORKSHEETS_URL, new RemoteWorksheetsHandler(mRemoteExecutor));
        Log.d(TAG, "remote sync took " + (System.currentTimeMillis() - startRemote) + "ms");

    } catch (Exception e) {
        Log.e(TAG, "Problem while syncing", e);

        if (receiver != null) {
            // Pass back error to surface listener
            final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, e.toString());
            receiver.send(STATUS_ERROR, bundle);
        }
    }

    // Announce success to any surface listener
    Log.d(TAG, "sync finished");
    if (receiver != null)
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
}

From source file:com.cssweb.android.quote.QHHQActivity.java

private void loadAllStock(final int position) {
    Intent localIntent = new Intent();
    if (position == 0) {
        localIntent.setClass(QHHQActivity.this, ZJS.class);
        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "cffex");
        extras.putString("exchange", "cf");
        extras.putString("title", "");
        localIntent.putExtras(extras);/*from  ww  w. ja  v  a2  s.  c o m*/

    } else if (position == 1) {
        localIntent.setClass(QHHQActivity.this, SQS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "sfe");
        extras.putString("exchange", "sf");
        extras.putString("title", "");
        extras.putInt("type", R.array.sqs_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 2) {
        localIntent.setClass(QHHQActivity.this, DSS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "dce");
        extras.putString("exchange", "dc");
        extras.putString("title", "");
        extras.putInt("type", R.array.dss_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 3) {
        localIntent.setClass(QHHQActivity.this, ZSS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "czce");
        extras.putString("exchange", "cz");
        extras.putString("title", "");
        extras.putInt("type", R.array.zss_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 4) {
        localIntent.setClass(QHHQActivity.this, QQSP.class);
    }
    startActivity(localIntent);
}

From source file:com.easy.facebook.android.facebook.FBLoginManager.java

private void startDialogAuth(Activity activityDialog, String[] permissions) throws EasyFacebookError {
    Bundle params = new Bundle();
    if (permissions.length > 0) {
        params.putString("scope", TextUtils.join(",", permissions));
    }/*  w ww.  j  av a 2 s  .c om*/
    CookieSyncManager.createInstance(activityDialog);
    dialog(activityDialog, "oauth", params, new LoginListener() {

        public void loginSuccess(Facebook facebook) {

            CookieSyncManager.getInstance().sync();

            ((LoginListener) activity).loginSuccess(facebook);

        }

        public void logoutSuccess() {
            ((LoginListener) activity).logoutSuccess();

        }

        public void loginFail() {
            ((LoginListener) activity).loginFail();

        }
    });
}

From source file:com.miz.mizuu.Actor.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("tab", awesomePager.getCurrentItem());
    outState.putString("json", json);
    outState.putString("baseUrl", baseUrl);
}