Intent putExtra - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Intent putExtra method.

This code example shows how to use the following methods: putExtra
    protected Object onGetDefaultValue(TypedArray a, int index) {
        return a.getString(index);
    } 
 
    protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
        ringtonePickerIntent.putExtra(
                RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                onRestoreRingtone()); 
        ringtonePickerIntent.putExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, mShowDefault);
        if (mShowDefault) {
            ringtonePickerIntent.putExtra(
                    RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    RingtoneManager.getDefaultUri(getRingtoneType()));
        } 
        ringtonePickerIntent.putExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent);
        ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
                mRingtoneType);
        ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,

9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: putExtra
 
  @TargetApi(11) 
  @Override 
  public void onSharedPreferenceChanged(SharedPreferences prefs,
                                        String key) {
    Intent i=new Intent(ACTION_SYNC_PREF);
    Object value=prefs.getAll().get(key);
 
    i.putExtra(EXTRA_SENDER, getPackageName());
    i.putExtra(EXTRA_KEY, key);
 
    if (value instanceof Boolean) {
      i.putExtra(EXTRA_VALUE, (Boolean)value);
      i.putExtra(EXTRA_TYPE, TYPE_BOOLEAN);
    } 
    else if (value instanceof Float) {
      i.putExtra(EXTRA_VALUE, (Float)value);
      i.putExtra(EXTRA_TYPE, TYPE_FLOAT);
    } 
    else if (value instanceof Integer) {

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: putExtra, setAction
        signer.update(requiredPrevious.trim().getBytes());
        return signer.verify(Base64.decode(signature.getBytes(), Base64.DEFAULT));
    } 
 
    private void sendIntent(String contentPath, String version, String required, String sig) {
        Intent i = new Intent();
        i.setAction("android.intent.action.UPDATE_PINS");
        i.putExtra(EXTRA_CONTENT_PATH, contentPath);
        i.putExtra(EXTRA_VERSION_NUMBER, version);
        i.putExtra(EXTRA_REQUIRED_HASH, required);
        i.putExtra(EXTRA_SIGNATURE, sig);
        mContext.sendBroadcast(i);
    } 
 
    private String runTest(String cert, String content, String version, String required, String sig)
                           throws Exception { 
        Log.e(TAG, "started test");
        overrideCert(cert);
        String contentPath = makeTemporaryContentFile(content);
        sendIntent(contentPath, version, required, sig);
Full Snippet Info
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: putExtra
     * This is fired by the listener on the microphone-button. 
     * 
     * @param prompt Specify the R.string.string_id resource for the prompt-text during voice-recognition here 
     */ 
    public void startVoiceRecognitionActivity(Fragment fragment, int prompt) {
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel);
        intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, ContextManager.getContext().getString(prompt));
        String detailMessage = "Error! No Fragment or Activity was registered to handle this voiceinput-request!";
        if (activity != null)
            activity.startActivityForResult(intent, requestCode);
        else if (fragment != null)
            fragment.startActivityForResult(intent, requestCode);
        else 
            Log.e("Astrid VoiceInputAssistant", detailMessage, new IllegalStateException(detailMessage));
    } 
 
    /** 
     * This callback-method has to be called from Fragment.onActivityResult within your fragment 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: putExtra
        } 
        catch (Exception e) {
            Log.e(LOG_TAG, String.format("startSpeechRecognitionActivity exception: %s", e.toString()));
        } 
 
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH);
        if (maxMatches > 0)
            intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxMatches);
        if (!prompt.equals(""))
            intent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt);
        cordova.startActivityForResult(this, intent, reqCode);
    } 
 
    /** 
     * Handle the results from the recognition activity. 
     */ 
    @Override 
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
Full Snippet Info
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: createChooser, putExtra, setType
    static Context context;
 
    /* Deliver some data to someone else 
    */ 
    static void send(String mimeType, String filename, String subject, String text, String chooser_title) {
        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType(mimeType);
        /** tryied with String [] emails, but hard to code the whole C/Cython part. 
          if (emails != null) 
          emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emails); 
         **/ 
        if (subject != null)
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
        if (text != null)
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
        if (filename != null)
            emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filename));
        if (chooser_title == null)
            chooser_title = "Send mail";
        context.startActivity(Intent.createChooser(emailIntent, chooser_title));

9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getExtras, putExtra, removeExtra
    context.startActivity(intent);
  } 
 
  @Override 
  public void onReceive(Context context, Intent intent) {
    String phoneNumber        = intent.getExtras().getString(INTENT_PHONE_NUMBER);
    NumberFilter numberFilter = NumberFilter.deserializeFromFile(context);
 
    if( phoneNumber == null )
      return; 
 
    if (phoneNumber.endsWith(IGNORE_SUFFIX)) {
      phoneNumber = phoneNumber.substring(0, phoneNumber.length() - IGNORE_SUFFIX.length());
      intent.removeExtra(INTENT_PHONE_NUMBER);
      intent.removeExtra("android.phone.extra.ORIGINAL_URI");
 
      intent.putExtra(INTENT_PHONE_NUMBER, phoneNumber);
      intent.putExtra("android.phone.extra.ORIGINAL_URI", "tel:" + Uri.encode(phoneNumber));
 
      setResultData(phoneNumber);

10
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: addFlags, putExtra
  } 
 
  @Override 
  protected void onListItemClick(ListView l, View view, int position, long id) {
    if (cursor.moveToPosition(position)) {
      Intent intent = new Intent();
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
      intent.putExtra(Browser.BookmarkColumns.TITLE, cursor.getString(TITLE_COLUMN));
      intent.putExtra(Browser.BookmarkColumns.URL, cursor.getString(URL_COLUMN));
      setResult(RESULT_OK, intent);
    } else { 
      setResult(RESULT_CANCELED);
    } 
    finish();
  } 
} 
Full Snippet Info
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: putExtra, setType
     * Creates a sharing {@link Intent}. 
     * 
     * @return The sharing intent. 
     */ 
    private Intent createShareIntent() {
        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("image/*");
        Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
        return shareIntent;
    } 
 
    /** 
     * Copies a private raw resource content to a publicly readable 
     * file such that the latter can be shared with other applications. 
     */ 
    private void copyPrivateRawResuorceToPubliclyAccessibleFile() { 
        InputStream inputStream = null;
        FileOutputStream outputStream = null;
        try { 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: hasExtra, putExtra
import android.preference.PreferenceActivity; 
 
public class InputMethodAndSubtypeEnablerActivity extends PreferenceActivity {
    @Override 
    public Intent getIntent() {
        final Intent modIntent = new Intent(super.getIntent());
        if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
            modIntent.putExtra(EXTRA_SHOW_FRAGMENT, InputMethodAndSubtypeEnabler.class.getName());
            modIntent.putExtra(EXTRA_NO_HEADERS, true);
        } 
        return modIntent;
    } 
} 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Intent putExtra Questions & Answers:

Other Intent putExtra Examples

24:	    Intent intent = new Intent(context.getApplicationContext(),
25:	        UpdateWidgetService.class);
26:	    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds);
27:	
28:	    // Update the widgets via the service

Read More

16:	  public void onClick(View view) {
17:	    Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
18:	    intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
19:	        new ComponentName(this, MyWallpaperService.class));
20:	    startActivity(intent);

Read More

84:				// will close this activity and lauch main activity
85:				Intent i = new Intent(SplashScreen.this, MainActivity.class);
86:				i.putExtra("now_playing", now_playing);
87:				i.putExtra("earned", earned);
88:				startActivity(i);
-
85:				Intent i = new Intent(SplashScreen.this, MainActivity.class);
86:				i.putExtra("now_playing", now_playing);
87:				i.putExtra("earned", earned);
88:				startActivity(i);
89:

Read More

104:			fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
105:	
106:			intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
107:	
108:			// start the image capture Intent
-
140:	
141:			// set video quality
142:			intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
143:	
144:			intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file
-
142:			intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
143:	
144:			intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file
145:																// name
146:

Read More

8:			// set video quality
9:			// 1- for high quality video
10:			intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
11:	
12:			intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
-
10:			intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
11:	
12:			intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
13:	
14:			// start the video capture Intent

Read More

4:	        new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
5:	
6:	    activateDeviceAdminIntent.putExtra(
7:	        DevicePolicyManager.EXTRA_DEVICE_ADMIN,
8:	        mPolicy.getPolicyAdmin());
-
12:	    // administrator. The system will display this message on the activation
13:	    // screen.
14:	    activateDeviceAdminIntent.putExtra(
15:	        DevicePolicyManager.EXTRA_ADD_EXPLANATION,
16:	        getResources().getString(R.string.device_admin_activation_message));

Read More

putExtra Method Overview
Add extended data to the intent.
See Code Examples for other Android Intent Methods: