Context startActivity - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getSystemService, startActivity
    void startCallActivity() { 
        sendCloseSystemWindows(); 
        Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try { 
            mContext.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Slog.w(TAG, "No activity found for android.intent.action.CALL_BUTTON.");
        } 
    } 
 
    SearchManager getSearchManager() {
        if (mSearchManager == null) {
            mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
        } 
        return mSearchManager;
    } 
 
    TelephonyManager getTelephonyManager() {
        if (mTelephonyManager == null) {

8
CodeRank
This code example shows how to use the following methods:startActivity
public class Util { 
 
	public static void goToGitHub(Context context) {
		Uri uriUrl = Uri.parse("http://github.com/jfeinstein10/slidingmenu");
		Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); 
		context.startActivity(launchBrowser);
	} 
	 
} 
7
CodeRank
This code example shows how to use the following methods:getActivity, getPackageName, startActivity
This code example shows how to use the following methods:getPackageManager, getString, startActivity
		intent.setData(Uri.parse(url));
		context.startActivity(intent);
	} 
 
	public static void startEmailActivity(Context context, int toResId, int subjectResId, int bodyResId) {
		startEmailActivity(context, context.getString(toResId), context.getString(subjectResId),
				context.getString(bodyResId));
	} 
 
	public static void startEmailActivity(Context context, String to, String subject, String body) {
		final Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("message/rfc822");
 
		if (!TextUtils.isEmpty(to)) {
			intent.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
		} 
		if (!TextUtils.isEmpty(subject)) {
			intent.putExtra(Intent.EXTRA_SUBJECT, subject);
		} 
		if (!TextUtils.isEmpty(body)) {

7
CodeRank
This code example shows how to use the following methods:startActivity, getDefaultSharedPreferences
	public void onReceive(Context context, Intent intent) {
		 
		// Received intent only when the system boot is completed 
		Log.d(TAG, "onReceiveIntent");
 
		SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
		boolean startupOnBoot = sharedPreferences.getBoolean("setting_startup_onboot", false);
		if (startupOnBoot) {
			Intent activityIntent = new Intent(context, HomeActivity.class);
			activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(activityIntent);
		} 
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:getSystemService, startActivity
    void startCallActivity() { 
        sendCloseSystemWindows(); 
        Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try { 
            mContext.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Slog.w(TAG, "No activity found for android.intent.action.CALL_BUTTON.");
        } 
    } 
 
    SearchManager getSearchManager() {
        if (mSearchManager == null) {
            mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
        } 
        return mSearchManager;
    } 
 
    TelephonyManager getTelephonyManager() {
        if (mTelephonyManager == null) {

7
CodeRank
This code example shows how to use the following methods:getString, startActivity
	} 
	 
	public static void gotoUrl(Context context, String url) throws ActivityNotFoundException {
		if ( url != null && url.length() > 0 ) {
			Uri uri = Uri.parse(url);
			context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
		} 
	} 
	 
	public static void gotoUrl(Context context, int resId) throws ActivityNotFoundException {
		gotoUrl(context, context.getString(resId));
	} 
 
	public static String getEditText(Activity act, int resId) {
		TextView te =  (TextView) act.findViewById(resId);
		assert(te == null);
		 
		if (te != null) {
			return te.getText().toString();
		} else { 
7
CodeRank
This code example shows how to use the following methods:startActivity
    } 
 
    @Override 
    protected void onClick() { 
        // Show Sync setup if no accounts exist; otherwise, show account settings. 
        if (SyncAccounts.syncAccountsExist(mContext)) {
            SyncAccounts.openSyncSettings(mContext);
        } else { 
            Intent intent = new Intent(mContext, SetupSyncActivity.class);
            mContext.startActivity(intent);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:startActivity
This code example shows how to use the following methods:getSharedPreferences, startActivity, makeText
		} else if (intent.getStringExtra("unregistered") != null) {
			Log.d("c2dm", "unregistered");
 
		} else if (registration != null) {
 
			Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
			editor.putString(REGISTRATION_KEY, registration);
			System.out.println(registration);
			editor.commit();
 
			Intent accountIntent = new Intent(context,AccountList.class);
			accountIntent.putExtra("regKey",registration) ;
			accountIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
			context.startActivity(accountIntent);
		} 
		Toast.makeText(context, registration, Toast.LENGTH_LONG);
	} 
 
	private void handleMessage(Context context, Intent intent)
	{ 
		Log.v(TAG,"handleMessage");
6
CodeRank

Related Context startActivity Questions & Answers:

Other Context startActivity Examples

166:							Intent intent = new Intent(
167:									Settings.ACTION_LOCATION_SOURCE_SETTINGS);
168:							mContext.startActivity(intent);
169:						}
170:					});

Read More

73:				
74:				// Staring Login Activity
75:				_context.startActivity(i);
76:			}
77:			
-
112:			
113:			// Staring Login Activity
114:			_context.startActivity(i);
115:		}
116:

Read More

163:	            public void onClick(DialogInterface dialog,int which) {
164:	            	Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
165:	            	mContext.startActivity(intent);
166:	            }
167:	        });

Read More

startActivity Method Overview
Same as startActivity(Intent, Bundle) with no options specified.
See Code Examples for other Android Context Methods: