Example usage for android.content Intent putExtras

List of usage examples for android.content Intent putExtras

Introduction

In this page you can find the example usage for android.content Intent putExtras.

Prototype

public @NonNull Intent putExtras(@NonNull Bundle extras) 

Source Link

Document

Add a set of extended data to the intent.

Usage

From source file:com.mirasense.scanditsdk.plugin.FullScreenPickerActivity.java

@Override
public void didEnter(String entry) {
    if (!mContinuousMode) {
        Intent intent = new Intent();
        intent.putExtras(manualSearchResultsToBundle(entry.trim()));
        setResult(MANUAL, intent);/*from  w  ww . j  a  v  a2  s.co  m*/
        finish();
        return;
    }

    Bundle bundle = manualSearchResultsToBundle(entry.trim());
    ResultRelay.relayResult(bundle);
}

From source file:com.ateam.alleneatonautorentals.SalesViewUsers.java

@Override
public void onBackPressed() {
    Intent ii = new Intent(SalesViewUsers.this, MainMenu.class);
    Bundle b = new Bundle();
    b.putString("employeeType", "Sales");
    ii.putExtras(b);

    startActivity(ii);//from  ww w  .ja v  a  2s. co m
    finish();
}

From source file:edu.cwru.apo.Home.java

@Override
public void onResume() {
    super.onResume();
    if (!Auth.loggedIn) {
        Intent nextActivity = new Intent(Home.this, Login.class);
        Bundle extras = new Bundle();
        nextActivity.putExtras(extras);
        Home.this.startActivity(nextActivity);
        finish();/*from  w ww.jav a 2s .c  o  m*/
    }
}

From source file:com.jaspersoft.android.jaspermobile.test.acceptance.SearchableActivityTest.java

private void configureSearchIntent() {
    Intent launchIntent = new Intent();
    launchIntent.setAction(Intent.ACTION_SEARCH);
    Bundle extras = new Bundle();
    extras.putString(SearchableActivity_.QUERY_EXTRA, SEARCH_QUERY);
    launchIntent.putExtras(extras);
    setActivityIntent(launchIntent);//w w w.ja va 2 s  .  co m
}

From source file:de.elanev.studip.android.app.frontend.forums.ForumEntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (isAdded()) {
        switch (item.getItemId()) {
        case android.R.id.home:
            getActivity().onBackPressed();

            return true;
        case R.id.forum_area_add:
            Bundle args = new Bundle();
            args.putString(ForumEntry.ID, mEntryId);
            args.putSerializable(ForumEntryComposeFragment.ENTRY_TYPE,
                    ForumEntryComposeFragment.EntryType.REPLY_ENTRY);

            Intent intent = new Intent(getActivity(), ForumEntryComposeActivity.class);
            intent.putExtras(args);
            startActivityForResult(intent, CREATE_ENTRY);

            return true;
        default://from www .j a v a 2 s  .  c  om
            return super.onOptionsItemSelected(item);
        }
    }
    return true;
}

From source file:com.deliciousdroid.activity.FragmentBaseActivity.java

@Override
@TargetApi(14)//from  w  w  w . j a va 2s.co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;
    mAccountManager = AccountManager.get(this);
    settings = PreferenceManager.getDefaultSharedPreferences(this);

    loadSettings();
    init();

    if (android.os.Build.VERSION.SDK_INT >= 14) {
        getActionBar().setHomeButtonEnabled(true);
    }

    Intent intent = getIntent();

    if (Intent.ACTION_SEARCH.equals(intent.getAction()) && !intent.hasExtra("MainSearchResults")) {
        if (intent.hasExtra(SearchManager.QUERY)) {
            Intent i = new Intent(this, MainSearchResults.class);
            i.putExtras(intent.getExtras());
            startActivity(i);
            finish();
        } else {
            onSearchRequested();
        }
    } else if (Constants.ACTION_SEARCH_SUGGESTION.equals(intent.getAction())) {
        Uri data = intent.getData();
        String path = null;
        String tagname = null;

        if (data != null) {
            path = data.getPath();
            tagname = data.getQueryParameter("tagname");
        }

        if (data.getScheme() == null || !data.getScheme().equals("content")) {
            Intent i = new Intent(Intent.ACTION_VIEW, data);
            startActivity(i);
            finish();
        } else if (path.contains("bookmarks") && TextUtils.isDigitsOnly(data.getLastPathSegment())
                && intent.hasExtra(SearchManager.USER_QUERY)) {
            Intent viewBookmark = new Intent(this, ViewBookmark.class);
            viewBookmark.setAction(Intent.ACTION_VIEW);
            viewBookmark.setData(data);
            viewBookmark.removeExtra(SearchManager.USER_QUERY);
            Log.d("View Bookmark Uri", data.toString());
            startActivity(viewBookmark);
            finish();
        } else if (tagname != null) {
            Intent viewTags = new Intent(this, BrowseBookmarks.class);
            viewTags.setData(data);

            Log.d("View Tags Uri", data.toString());
            startActivity(viewTags);
            finish();
        }
    }
}

From source file:com.bellman.bible.android.view.activity.search.SearchIndex.java

/**
 * Show progress monitor screen//from  w  w w. j ava 2 s .c o  m
 */
private void monitorProgress() {
    // monitor the progress
    Intent intent = new Intent(this, SearchIndexProgressStatus.class);

    // a search may be pre-defined, if so then pass the pre-defined search through so it can be executed directly
    if (getIntent().getExtras() != null) {
        intent.putExtras(getIntent().getExtras());
    }

    // always need to specify which document is being indexed
    if (StringUtils.isEmpty(intent.getStringExtra(SearchControl.SEARCH_DOCUMENT))) {
        // must tell the progress status screen which doc is being downloaded because it checks it downloaded successfully
        intent.putExtra(SearchControl.SEARCH_DOCUMENT, getDocumentToIndex().getInitials());
    }

    startActivity(intent);
    finish();
}

From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java

private void pickVideo() throws Exception {
    checkDirectory();//from w  w  w  .j av a2s. c  om
    try {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        if (extras != null) {
            intent.putExtras(extras);
        }
        intent.setType("video/*");
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new Exception("Activity not found");
    }
}

From source file:com.easemob.chatuidemo.activity.AddContactActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    User user = list.get(position);//from  w  w  w .  ja  v a2 s. co  m
    Intent it = new Intent();
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    it.putExtras(bundle);
    it.setClass(this, Activity_boshu_AddFriend.class);
    startActivity(it);
}

From source file:be.evias.cloudLogin.cloudLoginMainActivity.java

/**
 * First thing when the activity is created is to check if
 * the connection to the server is UP.// w  w w  . j  a v a 2 s .c o m
 * If not finish the activity and tell the user.
 **/
public void checkConnection() {
    new AsyncTask<String, Void, Intent>() {
        @Override
        protected Intent doInBackground(String... params) {
            Bundle data = new Bundle();
            try {
                ServiceBase service = new ServiceBase();
                mIsConnectionUp = service.ping(mContext);
            } catch (Exception e) {
            }

            final Intent res = new Intent();
            res.putExtras(data);
            return res;
        }

        @Override
        protected void onPostExecute(Intent intent) {
            if (mIsConnectionUp == false) {
                showMessage(mContext.getString(R.string.error_network), Toast.LENGTH_LONG);
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    }.execute();
}