Best code examples for Android Activity class (android.app.Activity)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Activity class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Activity examples from Open Source projects
This code example shows how to use the following methods: setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setTitle
250:	parent.setProgressBarIndeterminate(false); 
251:	parent.setProgressBarIndeterminateVisibility(false); 
252:	parent.setProgressBarVisibility(false); 
253:	parent.setTitle(statusBarTitle); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getString, getPackageName, getResources
83:	progressDialogTitleId = activity.getResources().getIdentifier( 
84:	PROGRESS_DIALOG_TITLE_RESOURCE, "string", activity.getPackageName()); 
-
88:	progressDialogMsgId = activity.getResources().getIdentifier( 
89:	PROGRESS_DIALOG_MESSAGE_RESOURCE, "string", activity.getPackageName()); 
-
91:	progressDialog.setMessage(activity.getString(progressDialogMsgId)); 
-
93:	progressDialog.setOnKeyListener(new OnKeyListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addAction, addDataScheme, registerReceiver
148:	IntentFilter filter = new IntentFilter(); 
149:	filter.addAction(Intent.ACTION_PACKAGE_ADDED); 
150:	filter.addAction(Intent.ACTION_PACKAGE_CHANGED); 
151:	filter.addAction(Intent.ACTION_PACKAGE_REMOVED); 
152:	filter.addAction(Intent.ACTION_PACKAGE_REPLACED); 
153:	filter.addDataScheme("package"); 
154:	getActivity().registerReceiver(mPackageReceiver, filter); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addAction, registerReceiver
164:	IntentFilter filter = new IntentFilter(); 
165:	filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); 
166:	filter.addAction(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED); 
167:	getActivity().registerReceiver(mReceiver, filter); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: get
72:	final AccountManager manager = AccountManager.get(activity); 
73:	final Account account = AccountUtils.getAccount(manager, activity); 
-
84:	&& AccountUtils.updateAccount(account, activity)) 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: get
72:	final AccountManager manager = AccountManager.get(activity); 
-
75:	account = AccountUtils.getAccount(manager, activity); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getActivity, getApplicationContext, getClass
48:	intent = PendingIntent.getActivity(activity, 0, new Intent(activity, activity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); 
-
96:	if (MoSyncNFC.nfcPermissionsSet(activity)) { 
97:	NfcAdapter nfc = NfcAdapter.getDefaultAdapter(activity.getApplicationContext()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: finish, startActivity
83:	pActivity.startActivity(pCancelIntent); 
-
85:	pActivity.finish(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: startActivityForResult
179:	activity.startActivityForResult(intentScan, REQUEST_CODE); 
-
194:	downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSystemService, getResources
43:	loader = ImageLoader.getLoader(context); 
-
45:	.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
46:	displayMetrics = context.getResources().getDisplayMetrics(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getActivity
17:	PendingIntent pendingIntent = PendingIntent.getActivity(new Activity(), 0, new Intent(), 0); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSystemService, setVolumeControlStream, getClass
84:	KeyguardManager keyguardManager = (KeyguardManager) activity.getSystemService(Activity.KEYGUARD_SERVICE); 
-
111:	if(activity.getClass().equals(RemoteActivity.class)) 
-
124:	activity.setVolumeControlStream(AudioManager.STREAM_MUSIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getLayoutInflater
47:	super.configureList(activity, listView); 
-
53:	.addHeader(activity.getLayoutInflater() 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: startActivity
39:	ITroveboxApi mTrovebox = Preferences.getApi(activity); 
40:	String url = mTrovebox.getOAuthUrl("Trovebox Android App", 
-
43:	activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri 
-
47:	GuiUtils.error(TAG, null, ex, activity); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getWindow, getWindowManager, getDefaultSharedPreferences
35:	SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity); 
-
52:	Display display = activity.getWindowManager().getDefaultDisplay(); 
-
73:	activity.getWindow().setBackgroundDrawable(mThemeDrawable); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, startActivity, setClass, makeText
61:	Toast.makeText(context,message,Toast.LENGTH_LONG).show(); 
-
63:	Intent i = new Intent().setClass(context, TabWidget.class); 
64:	context.startActivity(i); 
-
66:	context.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadAnimation
25:	Animation anim = AnimationUtils.loadAnimation(new Activity(), R.anim.fade_in); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, startActivity
29:	activity.startActivity(new Intent(activity, activityClass)); 
30:	activity.finish(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: runOnUiThread
17:	ofActivity.runOnUiThread(new Runnable(){ 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getLayoutInflater
46:	super.configureList(activity, listView); 
-
51:	getListAdapter().addHeader(activity.getLayoutInflater() 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getLayoutInflater, getResources
164:	LayoutInflater inflater = activity.getLayoutInflater(); 
-
171:	float scale = activity.getResources().getDisplayMetrics().density; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getString
168:	screenMessage = activity.getString(((ResourceMessageException) error) 
-
179:	builder.setPositiveButton(activity.getString(android.R.string.ok), new OnClickListener() { 
-
192:	return newErrorDialog(activity, activity.getString(titleId), error); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActivity
17:	PendingIntent pendingIntent = PendingIntent.getActivity(new Activity(), 0, new Intent(), 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPackageManager
62:	final PackageManager packageManager = this.activity.getPackageManager(); 
-
72:	this.iabHelper = new IabHelper(this.activity); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, getFilesDir
30:	File sampleImage1 = new File(mActivity.getFilesDir() 
-
34:	File sampleImage2 = new File(mActivity.getFilesDir() 
-
38:	mActivity.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getComponentName, startActivity, getPackageManager
70:	ResolveInfo info = activity.getPackageManager().resolveActivity(intent, 
-
73:	ComponentName myName = activity.getComponentName(); 
-
83:	activity.startActivity(intent); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: runOnUiThread, getString, makeText
83:	showToast( activity, activity.getString( resId, formatArgs ) ); 
-
104:	sToast = Toast.makeText( activity, message, Toast.LENGTH_SHORT ); 
-
124:	activity.runOnUiThread( sToastMessager ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, startActivity
99:	AccountHolder.getInstance(context).setAccount(account); 
-
101:	context.startActivity(i); 
-
103:	context.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, sleep
96:	Thread.sleep(WAIT_FOR_SWITCH_CAMERA); 
-
98:	act.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish
51:	mActivity.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
21:	CursorLoader cursorLoader = new CursorLoader(new Activity(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, sleep
102:	Thread.sleep(WAIT_FOR_SWITCH_CAMERA); 
-
104:	act.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish
318:	activity.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: deleteFile, openFileOutput, openOrCreateDatabase
92:	SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); 
-
96:	mActivity.deleteFile(fileName); 
-
164:	SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); 
-
176:	FileOutputStream fos = mActivity.openFileOutput(fileName, Context.MODE_PRIVATE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
28:	context = new Activity(); 
-
30:	authenticationGateway = new AuthenticationGateway(apiGateway, context); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish
63:	mActivity.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: get
32:	Activity a = new Activity(); 
33:	assertThat(AccountManager.get(a)).isNotNull(); 
34:	assertThat(AccountManager.get(a)).isNotSameAs(appAM); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getContentResolver
22:	activity = new Activity(); 
23:	contentResolver = activity.getContentResolver(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, makeText
208:	Toast.makeText(host, text, Toast.LENGTH_SHORT).show(); 
-
211:	host.finish(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: show
116:	final ProgressDialog progress = ProgressDialog.show(activity, null, message, true, false); 
-
118:	final Thread runner = new Thread() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getApplication, startActivity
64:	Intent movie = new Intent ( sActivity.getApplication (), MoaiMoviePlayer.class ); 
-
66:	sActivity.startActivity ( movie ); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivityForResult, setAction
47:	Intent checkIntent = new Intent(); 
48:	checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); 
49:	((Activity) context).startActivityForResult(checkIntent, 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: onCreateOptionsMenu, equals
53:	if (mAttachedActivity == null || mAttachedActivity.equals(getActivity())) return; 
54:	mAttachedActivity.onCreateOptionsMenu(menu); 
Full Snippet Info
7
CodeRank
Related Android Activity Questions & Answers:
Other Android Activity Examples
3:	import android.os.Bundle;
4:	
5:	public class ScaleDetectorTestActivity extends Activity {
6:	  /** Called when the activity is first created. */
7:	  @Override

Read More

See Code Examples for Android Activity Methods: