My mobile Butler (20) Application Management Introduction Popupwindow Click events
android:drawabletop= show pictures in "@drawable/img2"//textview
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "Horizontal" > <TextViewAndroid:id= "@+id/tv_lanuch"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:drawabletop= "@drawable/img2"Android:text= "Start" /> <TextViewAndroid:id= "@+id/tv_uninstall"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:drawabletop= "@drawable/img1"Android:text= "Unload" /> <TextViewAndroid:id= "@+id/tv_share"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:drawabletop= "@drawable/img3"Android:text= "Share" /></LinearLayout>
Corresponding Click events for the three people:
(1) Application start-up requires the use of Packagemanager according to the specified PackageName
To launch the appropriate application Pm.getlaunchintentforpackage (PackageName);
(2) Uninstall the application , after the uninstallation is complete, rewrite the refresh interface, using the start activity with callback value
To the appropriate uninstall interface,
Intent Intent = new Intent (intent.action_delete); Intent.addcategory (Intent.category_default); Intent.setdata (Uri.parse ("package:" +packagename));
/*** Launch App*/ Public voidlaunch (String packagename) {packagemanager pm=Getpackagemanager (); //Get the App Launcher screen IntentIntent Intent =pm.getlaunchintentforpackage (PackageName); StartActivity (Intent); } /*** Uninstall App*/ Public voidUninstall (String packagename) {//Jump to uninstall interfaceIntent Intent =NewIntent (Intent.action_delete); Intent.addcategory (Intent.category_default); Intent.setdata (Uri.parse ("Package:" +PackageName)); Startactivityforresult (Intent,0); } /*** Share Apps*/ Public voidShare (String packagename) {Intent Intent=NewIntent (intent.action_send); Intent.settype ("Text/plain");//Send TextIntent.putextra (Intent.extra_text, PackageName); StartActivity (Intent); } Public voidStartactivityforresult (Intent Intent,intRequestcode) {Initappdata ();//after the uninstallation is complete, rewrite the Refresh interface
Super. Startactivityforresult (Intent, Requestcode); }
My mobile Butler (20) Application Management Introduction Popupwindow Click events