The Get widget can be appwidgetmanager to get
List<appwidgetproviderinfo>
Widget=appwidgetmanager.getinstance (context). Getinstalledproviders ();
Get all Appwidgetproviderinfo
for (int i = 0; i < widget.size (); i++) {
Appwidgetproviderinfo Info=widget.get (i);
String Packname=info.provider.getpackagename ();
String Classname=info.provider.getclassname ();
LOG.E ("-------packname", packname);
LOG.E ("-------classname", classname);
}
Getting the package name of the program in the phone is similar to the startup class name and widget.
The application's startup class name, which is added in the Androidmanifest.xml file <activity>
<intent-filter>
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER"/>
</intent-filter>
Filter condition to specify that the class name is the first activity class to start
So let's go get the package name and startup class name of the application:
Intent appintent = new Intent (intent.action_main, NULL);
Appintent.addcategory (Intent.category_launcher);
List<resolveinfo> Resolveinfos = Context (contextual)
. Getpackagemanager (). Queryintentactivities (appintent, 0);
for (int i = 0; i < resolveinfos.size (); i++) {
ResolveInfo ResolveInfo = Resolveinfos.get (i);
String ClassName = resolveInfo.activityInfo.name;
String PackageName = resolveInfo.activityInfo.packageName;
LOG.E ("-------packname", PackageName);
LOG.E ("-------classname", classname);}
That's it.
If it is not clear, the following is attached Deom
NET Disk Http://pan.baidu.com/s/1sj4S5tV
This article is from the "Samuel" blog, make sure to keep this source http://huangsm.blog.51cto.com/8903178/1436708