Launch Activity By Using ResolveInfo

Last example shows how to get details via resolveInfo, In this example we will explain how we can start activity specified in intent.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it ActivityFromResolveInfo.

2.) Run for output.

Steps:

1.) Create a project named ActivityFromResolveInfo and set the information as stated in the image.

Build Target: Android 4.4
Application Name: ActivityFromResolveInfo
Package Name: com.example.ActivityFromResolveInfo
Activity Name: ActivityFromResolveInfoActivity

activityresolve1

2.) Open ActivityFromResolveInfoActivity.java file and write following code there:

 

 

 

3.) Compile and build the project.

Output

activityresolve2

activityresolve3

activityresolve4