Intent getStringExtra - 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 getStringExtra method.

This code example shows how to use the following methods:getAction, getBundleExtra, getParcelableExtra, getStringExtra
    super("InterpreterService"); 
  } 
   
  @Override 
  protected void onHandleIntent(Intent intent) {
    String action=intent.getAction();
    I_Interpreter interpreter=interpreters.get(action);  
     
    if (interpreter==null) {
      try { 
        interpreter=(I_Interpreter)Class.forName(action).newInstance();
        interpreters.put(action, interpreter);
      } 
      catch (Throwable t) {
        Log.e("InterpreterService", "Error creating interpreter", t);
      } 
    } 
     
    if (interpreter==null) {
      failure(intent, "Could not create interpreter: "+intent.getAction());

9
CodeRank
This code example shows how to use the following methods:getStringExtra
 
    } 
     
     
    private void handleRegistration(final Context context, Intent intent) {
        final String registrationId = intent.getStringExtra(EXTRA_REGISTRATION_ID);
        String error = intent.getStringExtra(EXTRA_ERROR);
        String removed = intent.getStringExtra(EXTRA_UNREGISTERED);
 
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "dmControl: registrationId = " + registrationId +
                ", error = " + error + ", removed = " + removed);
        } 
 
        if (removed != null) {
            // Remember we are unregistered 
            C2DMessaging.clearRegistrationId(context);
            onUnregistered(context);
            return; 
        } else if (error != null) {
8
CodeRank
This code example shows how to use the following methods:getAction, getBundleExtra, getParcelableExtra, getStringExtra
    super("InterpreterService"); 
  } 
   
  @Override 
  protected void onHandleIntent(Intent intent) {
    String action=intent.getAction();
    I_Interpreter interpreter=interpreters.get(action);  
     
    if (interpreter==null) {
      try { 
        interpreter=(I_Interpreter)Class.forName(action).newInstance();
        interpreters.put(action, interpreter);
      } 
      catch (Throwable t) {
        Log.e("InterpreterService", "Error creating interpreter", t);
      } 
    } 
     
    if (interpreter==null) {
      failure(intent, "Could not create interpreter: "+intent.getAction());

8
CodeRank
This code example shows how to use the following methods:getStringExtra, hasExtra
                    .putExtra(EXTRA_WRITE_PRIVACY, ensureDefaultAudience(audience));
        return validateKatanaActivityIntent(context, intent);
    } 
 
    public static boolean isErrorResult(Intent resultIntent) {
        return resultIntent.hasExtra(STATUS_ERROR_TYPE);
    } 
 
    public static Exception getErrorFromResult(Intent resultIntent) {
        if (!isErrorResult(resultIntent)) {
            return null; 
        } 
 
        String type = resultIntent.getStringExtra(STATUS_ERROR_TYPE);
        String description = resultIntent.getStringExtra(STATUS_ERROR_DESCRIPTION);
 
        if (type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
            return new FacebookOperationCanceledException(description);
        } 
        /* TODO parse error values and create appropriate exception class */ 
8
CodeRank
This code example shows how to use the following methods:getStringExtra
	} 
 
	@Override 
	public int onStartCommand(Intent intent, int flags, int startID) {
		int returnCode = super.onStartCommand(intent, flags, startID);
		this.projectPath = intent.getStringExtra("projectPath");
		this.projectName = intent.getStringExtra("uploadName");
		this.projectDescription = intent.getStringExtra("projectDescription");
		this.token = intent.getStringExtra("token");
		this.serverAnswer = "";
		this.result = true;
		this.notificationId = intent.getIntExtra("notificationId", 0);
 
		return returnCode;
	} 
 
	@Override 
	public void onCreate() { 
		super.onCreate(); 
	} 
7
CodeRank
This code example shows how to use the following methods:getParcelableExtra, getStringExtra
    } 
  } 
   
  @Override 
  protected void onHandleIntent(Intent intent) {
    String script=intent.getStringExtra(SCRIPT);
     
    if (script!=null) {
      try { 
        success(intent, i.eval(script).toString());
      } 
      catch (Throwable e) {
        Log.e("BshService", "Error executing script", e);
         
        try { 
          failure(intent, e.getMessage());
        } 
        catch (Throwable t) {
          Log.e("BshService",
                "Error returning exception to client", 

8
CodeRank
This code example shows how to use the following methods:getStringExtra
   *  the fields will be null. 
   */ 
  public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == REQUEST_CODE) {
      if (resultCode == Activity.RESULT_OK) {
        String contents = intent.getStringExtra("SCAN_RESULT");
        String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
        return new IntentResult(contents, formatName);
      } else { 
        return new IntentResult(null, null); 
      } 
    } 
    return null; 
  } 
 
  /** 
   * See {@link #shareText(Activity, CharSequence, CharSequence, CharSequence, CharSequence, CharSequence)} -- 
   * same, but uses default English labels. 
   */ 
  public static void shareText(Activity activity, CharSequence text) {
7
CodeRank
This code example shows how to use the following methods:getStringExtra
 
    } 
     
     
    private void handleRegistration(final Context context, Intent intent) {
        final String registrationId = intent.getStringExtra(EXTRA_REGISTRATION_ID);
        String error = intent.getStringExtra(EXTRA_ERROR);
        String removed = intent.getStringExtra(EXTRA_UNREGISTERED);
 
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "dmControl: registrationId = " + registrationId +
                ", error = " + error + ", removed = " + removed);
        } 
 
        if (removed != null) {
            // Remember we are unregistered 
            C2DMessaging.clearRegistrationId(context);
            onUnregistered(context);
            return; 
        } else if (error != null) {
8
CodeRank
This code example shows how to use the following methods:getByteArrayExtra, getIntExtra, getStringExtra
   *  the fields will be null. 
   */ 
  public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == REQUEST_CODE) {
      if (resultCode == Activity.RESULT_OK) {
        String contents = intent.getStringExtra("SCAN_RESULT");
        String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
        byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
        int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
        Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
        String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
        return new IntentResult(contents,
                                formatName,
                                rawBytes,
                                orientation,
                                errorCorrectionLevel);
      } 
      return new IntentResult(); 
    } 
    return null; 
8
CodeRank
This code example shows how to use the following methods:getAction, getParcelableExtra, getStringExtra
    public static final String BOX_RECEIVER_CLASS_NAME = "com.box.android.onecloud.OneCloudReceiver";
 
    @Override 
    public void onReceive(final Context context, final Intent intent) {
        OneCloudData oneCloudData = null;
        if (intent.getParcelableExtra(EXTRA_ONE_CLOUD) != null) {
            oneCloudData = (OneCloudData) intent.getParcelableExtra(EXTRA_ONE_CLOUD);
            oneCloudData.sendHandshake(context);
        } 
 
        if (intent.getAction().equals(ACTION_BOX_EDIT_FILE)) {
            onEditFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_CREATE_FILE)) {
            onCreateFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_VIEW_FILE)) {
            onViewFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_LAUNCH)) {

7
CodeRank

Related Intent getStringExtra Questions & Answers:

Other Intent getStringExtra Examples

27:	
28:			Intent i = getIntent();
29:			String now_playing = i.getStringExtra("now_playing");
30:			String earned = i.getStringExtra("earned");
31:	
-
28:			Intent i = getIntent();
29:			String now_playing = i.getStringExtra("now_playing");
30:			String earned = i.getStringExtra("earned");
31:	
32:			// Diplaying the text

Read More

71:	        // Get album id, song id
72:	        Intent i = getIntent();
73:	        album_id = i.getStringExtra("album_id");
74:	        song_id = i.getStringExtra("song_id");
75:	        
-
72:	        Intent i = getIntent();
73:	        album_id = i.getStringExtra("album_id");
74:	        song_id = i.getStringExtra("song_id");
75:	        
76:	        // calling background thread

Read More

78:	        // Get album id
79:	        Intent i = getIntent();
80:	        album_id = i.getStringExtra("album_id");
81:	
82:			// Hashmap for ListView

Read More

12:	
13:	    final String payload =
14:	            launchIntent.getStringExtra(NextActivity.EXTRAS_PAYLOAD_KEY);
15:	    assertEquals("Payload is empty", LaunchActivity.STRING_PAYLOAD, payload);
16:	}

Read More

getStringExtra Method Overview
Retrieve extended data from the intent.
See Code Examples for other Android Intent Methods: