Bundle get - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String valueStr = (String) icicle.get("softap_iterations");
        if (valueStr != null) {
            int iteration = Integer.parseInt(valueStr);
            if (iteration > 0) {
                mSoftapIterations = iteration;
            } 
        } 
 
        String scanIterationStr = (String) icicle.get("scan_iterations");
        if (scanIterationStr != null) {
            int scanIteration = Integer.parseInt(scanIterationStr);
            if (scanIteration > 0) {
                mScanIterations = scanIteration;
            } 
        } 

8
CodeRank
This code example shows how to use the following methods:get
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
 
        // parse all input arguments 
        String recipientPhoneNumber = (String) icicle.get("recipient");
        if (recipientPhoneNumber != null) {
            mRecipient = recipientPhoneNumber;
        } 
        String numMsgStr = (String) icicle.get("messages");
        if (numMsgStr != null) {
            mNumberMessages = Integer.parseInt(numMsgStr);
        } 
        String msgFileNameStr = (String) icicle.get("messagefile");
        if (msgFileNameStr != null) {
            mMessageFileName = msgFileNameStr;
        } 
        String recpFileNameStr = (String) icicle.get("recipientfile");
        if (recpFileNameStr != null) {
            mRecipientFileName = recpFileNameStr;

8
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String get_heap_dump = (String) icicle.get("get_heap_dump");
        if (get_heap_dump != null) {
            mGetNativeHeapDump = true;
        } 
 
        String get_procmem = (String) icicle.get("get_procmem");
        if (get_procmem != null) {
            mGetProcmem = true;
        } 
 
    } 
} 
 
7
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String iterations = (String) icicle.get("iterations");
        String video_encoder = (String) icicle.get("video_encoder");
        String audio_encoder = (String) icicle.get("audio_encoder");
        String frame_rate = (String) icicle.get("frame_rate");
        String video_width = (String) icicle.get("video_width");
        String video_height = (String) icicle.get("video_height");
        String bit_rate = (String) icicle.get("bit_rate");
        String record_duration = (String) icicle.get("record_duration");
        String remove_videos = (String) icicle.get("remove_videos");
 
        if (iterations != null ) {
            mIterations = Integer.parseInt(iterations);
        } 
        if ( video_encoder != null) {
            mVideoEncoder = Integer.parseInt(video_encoder);
7
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        // Extract the extra params passed in from the bundle... 
        String externalDownloadUri = (String) icicle.get(EXTERNAL_DOWNLOAD_URI_KEY);
        if (externalDownloadUri != null) {
            externalDownloadUriValue = externalDownloadUri;
        } 
        super.onCreate(icicle);
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:get
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
 
        String minCameraFps = (String) icicle.get("min_camera_fps");
        System.out.print("min_camera_" + minCameraFps);
 
        if (minCameraFps != null ) {
            mMinCameraFps = Integer.parseInt(minCameraFps);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String video_iterations = (String) icicle.get("video_iterations");
        String image_iterations = (String) icicle.get("image_iterations");
        String video_duration = (String) icicle.get("video_duration");
 
        if ( video_iterations != null ) {
            mVideoIterations = Integer.parseInt(video_iterations);
        } 
        if ( image_iterations != null) {
            mImageIterations = Integer.parseInt(image_iterations);
        } 
        if ( video_duration != null) {
            mVideoDuration = Integer.parseInt(video_duration);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:get, getString
        return LayoutTestsAutoRunner.class.getClassLoader();
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        this.mTestPath = (String) icicle.get("path");
        String timeout_str = (String) icicle.get("timeout");
        if (timeout_str != null) {
            try { 
                this.mTimeoutInMillis = Integer.parseInt(timeout_str);
            } catch (Exception e) {
                e.printStackTrace();
            } 
        } 
 
        String r = icicle.getString("rebaseline");
        this.mRebaseline = (r != null && r.toLowerCase().equals("true"));
 
        mJsEngine = icicle.getString("jsengine");
 

8
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String testSSID = (String) icicle.get("ssid");
        if (testSSID != null) {
            mTestSsid = testSSID;
        } 
        String wifiOnlyFlag = (String) icicle.get("wifi-only");
        if (wifiOnlyFlag != null) {
            mWifiOnlyFlag = true;
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:get
    public String mTestServer = "http://www.sometestserver.com";
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String ssidStr= (String) icicle.get("ssid");
        if (ssidStr != null) {
            mSsid = ssidStr;
        } 
        String serverStr = (String) icicle.get("server");
        if (serverStr != null) {
            mTestServer = serverStr;
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:containsKey, get
	 * @return the value from intent 
	 */ 
	@SuppressWarnings("unchecked") 
	public static <T> T getValueFromIntent( String key, T defaultValue ) {
		if ( mOriginalBundle != null ) {
			if ( mOriginalBundle.containsKey( key ) ) {
				T value;
				try { 
					value = (T) mOriginalBundle.get( key );
				} catch ( ClassCastException e ) {
					return defaultValue;
				} 
 
				if ( value != null ) return value;
				return defaultValue;
			} 
		} 
		return defaultValue;
	} 
 

6
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String strValue = (String)icicle.get("iterations");
        if (strValue != null) {
            int intValue = Integer.parseInt(strValue);
            if (iterations > 0) {
                iterations = intValue;
            } 
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:get
 
    @Override 
    public void onMessage(Context context, Intent intent) {
       Bundle extras = intent.getExtras();
       if (extras != null) {
           String name  = (String) extras.get("contact_name");
           String phone = (String) extras.get("phone_number");
           String sms = (String) extras.get("sms");
    	   Log.e(TAG, "Name: " + name + ", Phone: " + phone);
            
           if(name != null){
               Uri contactUri = insertContact(context, name, phone);
               if(getPrefs()[0]){ 
                   generateNotification(context, TYPE_CONTACT,name, phone, contactUri);
               } 
           } 
           else{ 
        	   Long threadId = getThreadIdFromPhone(context, phone);
        	   sendSMS(phone, sms);
        	   if(getPrefs()[0]){ 
7
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String get_heap_dump = (String) icicle.get("get_heap_dump");
        if (get_heap_dump != null) {
            mGetNativeHeapDump = true;
        } 
    } 
} 
 
6
CodeRank
This code example shows how to use the following methods:get
    } 
 
    @Override 
    public void onCreate(Bundle icicle) {
        // Extract the extra params passed in from the bundle... 
        String externalDownloadUri = (String) icicle.get(EXTERNAL_DOWNLOAD_URI_KEY);
        if (externalDownloadUri != null) {
            externalDownloadUriValue = externalDownloadUri;
        } 
        super.onCreate(icicle);
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:get, getCharSequence
		} 
	} 
 
	long getAudioId(Bundle bundle) {
		long id = NO_AUDIO_ID;
		Object idBundle = bundle.get("id");
		if (idBundle != null) {
			if (idBundle instanceof Long)
				id = (Long) idBundle;
			else if (idBundle instanceof Integer)
				id = (Integer) idBundle;
			else if (idBundle instanceof String) {
				id = Long.valueOf((String) idBundle).longValue();
			} else { 
				Log.w(TAG,
					"Got unsupported idBundle type: " + idBundle.getClass());
			} 
		} 
		return id;
	} 

7
CodeRank
This code example shows how to use the following methods:get
	@Override 
	public IBinder onBind(Intent intent) {
		Bundle extras = intent.getExtras();
		// Get messager from the Activity 
		if (extras != null) {
			outMessenger = (Messenger) extras.get("MESSENGER");
		} 
		// Return our messenger to the Activity to get commands 
		return inMessenger.getBinder();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:get
    private String buildToken(AccountManager manager, Account account, Activity activity)
            throws OperationCanceledException, AuthenticatorException, IOException { 
        AccountManagerFuture<Bundle> future = manager.getAuthToken(account, "ah", null, activity,
                null, null); // ah is app engine 
        Bundle token = future.getResult();
        return token.get(AccountManager.KEY_AUTHTOKEN).toString();
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:get
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == CAMERA_PIC_REQUEST) {
			if (data != null) {
				Bundle extras = data.getExtras();
				if(extras != null) {
					Bitmap thumbnail = (Bitmap) extras.get("data");
					if (thumbnail != null) {
						view.onImageChange(thumbnail);
					} 
				} 
			} 
		} 
		else if (requestCode == GALLERY_PIC_REQUEST) {
			if (data != null) {
				Uri selectedImageUri = data.getData();
				 
				if(selectedImageUri != null) {
 
					String[] projection = { MediaStore.Images.Media.DATA };
					 
5
CodeRank
This code example shows how to use the following methods:get
	 *  
	 * @return			The object data 
	 */ 
	public Object get(DataManager data, Bundle bundle) {
		if (mAccessor == null) {
			return bundle.get(mKey);
		} else { 
			return mAccessor.get(data, this, bundle);
		} 
	} 
 
	/** 
	 * Retrieve the data from the DataManager, translating and using Accessor as necessary. 
	 *  
	 * @param data		Parent collection 
	 * @param bundle	Raw data 
	 *  
	 * @return			Value of the data 
	 */ 
	public boolean getBoolean(DataManager data, Bundle bundle) {
5
CodeRank
This code example shows how to use the following methods:get
    @VisibleForTesting 
    static boolean isDirectoryProvider(ProviderInfo provider) {
        Bundle metaData = provider.metaData;
        if (metaData == null) return false;
 
        Object trueFalse = metaData.get(CONTACT_DIRECTORY_META_DATA);
        return trueFalse != null && Boolean.TRUE.equals(trueFalse);
    } 
 
    /** 
     * @return List of packages that contain a directory provider. 
     */ 
    @VisibleForTesting 
    static Set<String> getDirectoryProviderPackages(PackageManager pm) {
        final Set<String> ret = Sets.newHashSet();
 
        // Note to 3rd party developers: 
        // queryContentProviders() is a public API but this method doesn't officially support 
        // the GET_META_DATA flag.  Don't use it in your app. 
        final List<ProviderInfo> providers = pm.queryContentProviders(null, 0,
5
CodeRank
This code example shows how to use the following methods:get
		Log.e("C2DM", "Message: Fantastic!!!");
		try{ 
 
			Bundle extras = intent.getExtras();
			if (extras != null) {
				String data = (String)extras.get("payload");
				JSONObject jobj = new JSONObject(data);
				String email = jobj.getString("email");
 
				if(decide(jobj))
					sendNotification(context, intent, email);
			}	 
		} 
		catch(JSONException e){
			e.printStackTrace();
		} 
	} 
 
	private boolean decide(JSONObject jobj) throws JSONException {
 
5
CodeRank

Related Bundle get Questions & Answers:

Other Bundle get Examples

10:	             // Storing result in a variable called myvar
11:	             // get("website") 'website' is the key value result data
12:	    	     String mywebsite = data.getExtras().get("result");
13:	        }
14:

Read More

get Method Overview
Returns the entry with the given key as an object.
See Code Examples for other Android Bundle Methods: