Activity getIntent - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:finish, getIntent, startActivity
	@SuppressLint("NewApi") 
	public static void Recreate(Activity activity) {
		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB )
			activity.recreate();
		else{ 
			activity.finish();
			activity.startActivity(activity.getIntent());
		} 
		CheckScreenRotation(activity);
		CheckKeepAwake(activity);
	} 
	 
	/** 
	 * Set up the application theme based on Preferences:Constants.PREF_INVERT_COLOR 
	 * @param activity target activity 
	 * @param layoutId layout to use 
	 */ 
	public static void SetTheme(Activity activity, Integer layoutId) {
    	if(PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(Constants.PREF_INVERT_COLOR, true)) {    		
    		activity.setTheme(R.style.AppTheme2);
7
CodeRank
This code example shows how to use the following methods:getIntent, setIntent
     * the app can recognize (i.e. a normal {@link Intent#ACTION_VIEW} intent). 
     */ 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void tryUpdateIntentFromBeam(Activity activity) {
        if (UIUtils.hasICS()) { 
            Intent originalIntent = activity.getIntent();
            if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) {
                Parcelable[] rawMsgs = originalIntent.getParcelableArrayExtra(
                        NfcAdapter.EXTRA_NDEF_MESSAGES);
                NdefMessage msg = (NdefMessage) rawMsgs[0];
                // Record 0 contains the MIME type, record 1 is the AAR, if present. 
                // In iosched, AARs are not present. 
                NdefRecord mimeRecord = msg.getRecords()[0];
                if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals( 
                        new String(mimeRecord.getType()))) {
                    // Re-set the activity's intent to one that represents session details. 
                    Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(new String(mimeRecord.getPayload())));
                    activity.setIntent(sessionDetailIntent);
                } 

6
CodeRank
This code example shows how to use the following methods:getIntent, setIntent
     * the app can recognize (i.e. a normal {@link Intent#ACTION_VIEW} intent). 
     */ 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void tryUpdateIntentFromBeam(Activity activity) {
        if (UIUtils.hasICS()) { 
            Intent originalIntent = activity.getIntent();
            if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) {
                Parcelable[] rawMsgs = originalIntent.getParcelableArrayExtra(
                        NfcAdapter.EXTRA_NDEF_MESSAGES);
                NdefMessage msg = (NdefMessage) rawMsgs[0];
                // Record 0 contains the MIME type, record 1 is the AAR, if present. 
                // In iosched, AARs are not present. 
                NdefRecord mimeRecord = msg.getRecords()[0];
                if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals( 
                        new String(mimeRecord.getType()))) {
                    // Re-set the activity's intent to one that represents session details. 
                    Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(new String(mimeRecord.getPayload())));
                    activity.setIntent(sessionDetailIntent);
                } 

6
CodeRank
This code example shows how to use the following methods:getIntent, setTitle
        String portStr = port == -1 ? "" : Integer.toString(port);
        mPortField.setText(portStr);
 
        mExclusionListField.setText(exclList);
 
        final Intent intent = activity.getIntent();
 
        String buttonLabel = intent.getStringExtra("button-label");
        if (!TextUtils.isEmpty(buttonLabel)) {
            mOKButton.setText(buttonLabel);
        } 
 
        String title = intent.getStringExtra("title");
        if (!TextUtils.isEmpty(title)) {
            activity.setTitle(title);
        } 
    } 
 
    /** 
     * validate syntax of hostname and port entries 
6
CodeRank
This code example shows how to use the following methods:getIntent
		event(activity, tracker, EVENT_ANALYTICS, ANALYTICS_DISABLE, "");
	} 
	 
	/** Utility function for discerning an entry source from an activity's Intent. */  
	public static String entrySource(Activity activity) {
		Intent intent = activity.getIntent();
		String action = intent.getAction();
		boolean main = action != null && action.equals(Intent.ACTION_MAIN);
		if (main) {
			String source = ENTRY_MAIN;
			Bundle extras = intent.getExtras();
			if (extras != null) {
				String extra = extras.getString(EXTRA_ENTRY_FROM);
				if (extra != null)
					source = extra;
			} 
			return source;
		} else 
			return null; 
	} 
5
CodeRank
This code example shows how to use the following methods:getIntent
	 * @param activity 
	 *           the activity 
	 */ 
	public static void init( Activity activity ) {
		initContext( activity );
		initIntent( activity.getIntent() );
	} 
 
	/** 
	 * Get if the fast preview mode is enabled. If the 'effect-enable-fast-preview' intent-extra has been passed within the original 
	 * intent the intent value will be used, otherwise the device cpu speed will be used to determine the return value 
	 *  
	 * @return 
	 */ 
	public static boolean getFastPreviewEnabled() { 
		if ( mEnableFastPreview == null ) {
			boolean value = false;
			if ( containsValue( EXTRA_EFFECTS_ENABLE_FAST_PREVIEW ) ) {
				value = getValueFromIntent( EXTRA_EFFECTS_ENABLE_FAST_PREVIEW, false );
			} else { 
5
CodeRank

Related Activity getIntent Questions & Answers:

Other Activity getIntent Examples

26:			llStats.setVisibility(View.VISIBLE);
27:	
28:			Intent i = getIntent();
29:			String now_playing = i.getStringExtra("now_playing");
30:			String earned = i.getStringExtra("earned");

Read More

70:	        
71:	        // Get album id, song id
72:	        Intent i = getIntent();
73:	        album_id = i.getStringExtra("album_id");
74:	        song_id = i.getStringExtra("song_id");

Read More

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

Read More

getIntent Method Overview
Return the intent that started this activity.
See Code Examples for other Android Activity Methods: