Activity getComponentName - 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 getComponentName method.

This code example shows how to use the following methods:getComponentName, startActivity, getPackageManager
                        true, 0, "attachment", 0, 10)) { 
            // query the package manager to see if there's a registered handler 
            //     that matches. 
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.parse(url), mimetype);
            ResolveInfo info = activity.getPackageManager().resolveActivity(intent,
            if (info != null) {
                ComponentName myName = activity.getComponentName();
                // If we resolved to ourselves, we don't want to attempt to 
                // load the url only to try and download it again. 
                if (!myName.getPackageName().equals(
                        || !myName.getClassName().equals(
                    // someone (other than us) knows how to handle this mime 
                    // type with this scheme, don't download. 
                    try { 

Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getComponentName, getPackageManager, getResources
	public void testOrientation() throws NameNotFoundException { 
		Activity currentActivity = solo.getCurrentActivity();
		/// Method 1: Assert it is currently in portrait mode. 
		assertEquals("ScriptActivity not in Portrait mode!", Configuration.ORIENTATION_PORTRAIT, currentActivity
		/// Method 2: Retrieve info about Activity as collected from AndroidManifest.xml 
		PackageManager packageManager = currentActivity.getPackageManager();
		ActivityInfo activityInfo = packageManager.getActivityInfo(currentActivity.getComponentName(),
		// Note that the activity is _indeed_ rotated on your device/emulator! 
		// Robotium can _force_ the activity to be in landscape mode (and so could we, programmatically) 
		assertEquals(ScriptActivity.class.getSimpleName() + " not set to be in portrait mode in AndroidManifest.xml!",
				ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, activityInfo.screenOrientation);
Experience pair programming with AI  Get Codota for Java

Related Activity getComponentName Questions & Answers:

Other Activity getComponentName Examples

8:					.getActionView();
9:			searchView.setSearchableInfo(searchManager
10:					.getSearchableInfo(getComponentName()));
12:			return super.onCreateOptionsMenu(menu);

Read More

13:	         0,      // Unique item ID (none)
14:	         0,      // Order for the items (none)
15:	         this.getComponentName(),   // The current activity name
16:	         null,   // Specific items to place first (none)
17:	         intent, // Intent created above that describes our requirements

Read More

getComponentName Method Overview
Returns complete component name of this activity.
See Code Examples for other Android Activity Methods: