Android--手机卫士涉及的知识点总结(三)

简介: 可扩展的ListView(ExpandableListView控件) ? 1 2 3 4 5 6 7 8 9 10 11 ...

可扩展的ListView(ExpandableListView控件)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public class QuerryUsualNumber extends Activity {
 
     private ExpandableListView exl_listview;
     private SQLiteDatabase db;
     private TextView tv;
     private MyExpandableAdapter adapter;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super .onCreate(savedInstanceState);
         db=SQLiteDatabase.openDatabase( "/data/data/com.cca.mobilephone/files/commonnum.db" , null , SQLiteDatabase.OPEN_READONLY);
 
         setContentView(R.layout.activity_querryusualnumber);
 
         exl_listview = (ExpandableListView) findViewById(R.id.exl_listview);
         adapter = new MyExpandableAdapter();
         //设置适配器
         exl_listview.setAdapter(adapter);
 
         //孩子被点击的监听器
         exl_listview.setOnChildClickListener( new OnChildClickListener() {
             @Override
             public boolean onChildClick(ExpandableListView parent, View v,
                     int groupPosition, int childPosition, long id) {
                 //点击条目获得数据库返回的数据,并分割提取号码进行拨号                   
                 String data=UsualNumberDao.getChildrenNameByPosition(db, groupPosition, childPosition);
                 String datas[]=data.split( "\n" );
                 String name=datas[ 0 ];
 
                 String number=datas[ 1 ];
                 Toast.makeText(getApplicationContext(), groupPosition+ "--" +childPosition+ ":" +name+ ":" +number, 0 ).show();
 
                 //点击之后进行拨打指定号码的电话
                 Intent intent = new Intent();
                 intent.setAction(Intent.ACTION_CALL);
                 intent.setData(Uri.parse( "tel:" +number));
                 startActivity(intent);
 
                 return true ;
             }
         });
}

适配器

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
private class MyExpandableAdapter extends BaseExpandableListAdapter{
 
     /**
      * 获取分组的个数
      */
     @Override
     public int getGroupCount() {
         return UsualNumberDao.getGroupCount(db);
     }
     /**
      * 获取每个分组的孩子的个数
      */
     @Override
     public int getChildrenCount( int groupPosition) {
         return UsualNumberDao.getChildGroupCount(db,groupPosition);
     }
     @Override
     public Object getGroup( int groupPosition) {
         return null ;
     }
 
     @Override
     public Object getChild( int groupPosition, int childPosition) {
         return null ;
     }
     @Override
     public long getGroupId( int groupPosition) {
         return 0 ;
     }
     @Override
     public long getChildId( int groupPosition, int childPosition) {
         return 0 ;
     }
 
     @Override
     public boolean hasStableIds() {
         return false ;
     }
     /**
      * 返回每个分组的view对象
      */
     @Override
     public View getGroupView( int groupPosition, boolean isExpanded,
             View convertView, ViewGroup parent) {
         //TextView tv;
         if (convertView== null ){
         tv= new TextView(QuerryUsualNumber. this );
         } else {
             tv=(TextView) convertView;
         }
         tv.setTextSize( 25 );
         tv.setTextColor(Color.RED);
         tv.setText( "      " +UsualNumberDao.getNameByGroupCountposition(db,groupPosition));
         return tv;
     }
     @Override
     public View getChildView( int groupPosition, int childPosition,
             boolean isLastChild, View convertView, ViewGroup parent) {
 
         if (convertView== null ){
         tv= new TextView(QuerryUsualNumber. this );
         } else {
             tv=(TextView) convertView;
         }  
         tv.setTextSize( 20 );
         tv.setTextColor(Color.BLACK);
         tv.setText( " " +UsualNumberDao.getChildrenNameByPosition(db,groupPosition, childPosition));
         return tv;
     }
     @Override
     public boolean isChildSelectable( int groupPosition,
             int childPosition) {
 
         return true ;
     }
}
@Override
protected void onDestroy() {
     super .onDestroy();
     db.close();
 
}

接口回调解耦的应用(用短信备份加进度条对话框来举例)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
  * 短信备份
  *
  * @param view
  */
public void SMSBackUp(View view) {
     /**
      * 直接弹出一个进度条对话框
      */
     final ProgressDialog pb = new ProgressDialog( this );
     pb.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
     pb.setMessage( "正在备份......" );
 
     pb.show(); // show出来才能看得见
     new Thread() {
         public void run() {
 
             boolean result = SMSTool.SmsBackup(
                     new SMSTool.SmsBackupCallBack() {
                         /**
                          * 接口里面的方法
                          */
                         @Override
                         public void callBackprogress( int progress) {
                             pb.setProgress(progress);
                         }
 
                         /**
                          * 接口里面的方法
                          */
                         @Override
                         public void callBackMax( int max) {
                             pb.setMax(max);
                         }
                     }, ToolActivity. this , "back.xml" );
             if (result) {
                 ToastUtils.show(ToolActivity. this , "备份成功" );
             } else {
                 ToastUtils.show(ToolActivity. this , "备份失败" );
 
             }
             pb.dismiss(); // 是否备份成功对话框都消失
         };
     }.start();
 
}

短信备份的逻辑:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
     /**
  * 短信备份的工具类
  *
  * @author Administrator
  *
  */
public class SMSTool {
 
/**
  * 接口回调,定义一些抽象方法
  *
  * @author Administrator
  *
  */
public interface SmsBackupCallBack {
     /**
      * 接口回调
      *
      * @param max  最大值
      *          
      */
     public abstract void callBackMax( int max);
 
     /**
      * 接口回调
      *
      * @param progress
      */
     public abstract void callBackprogress( int progress);
 
}
 
/**
  * 短信备份的业务逻辑
  *
  * @param context   上下文
  *         
  * @param filename 存进的文件名
  *           
  * @return
  */
public static boolean SmsBackup(SmsBackupCallBack callBack,
         Context context, String filename) {
 
     try {
         ContentResolver resolver = context.getContentResolver();
         Uri uri = Uri.parse( "content://sms/" );
         Cursor cursor = resolver.query(uri, new String[] { "address" ,
                 "date" , "body" , "type" }, null , null , null );
         File file = new File(Environment.getExternalStorageDirectory(),
                 filename);
         FileOutputStream fos = new FileOutputStream(file);
         XmlSerializer serialer = Xml.newSerializer();
         // 设置序列化参数
         serialer.setOutput(fos, "utf-8" );
 
         serialer.startDocument( "utf-8" , true );
         serialer.startTag( null , "info" );
         cursor.moveToNext();
         int max = cursor.getCount();
         int progress = 0 ;
 
         //接口方法
         callBack.callBackMax(max);
 
         while (cursor.moveToNext()) {
             // cursor.moveToNext();
             serialer.startTag( null , "sms" );
 
             serialer.startTag( null , "address" );
             String address = cursor.getString( 0 );
             serialer.text(address);
             serialer.endTag( null , "address" );
 
             serialer.startTag( null , "date" );
             String date = cursor.getString( 1 );
             serialer.text(date);
             serialer.endTag( null , "date" );
 
             serialer.startTag( null , "body" );
             String body = cursor.getString( 2 );
             serialer.text(body);
             serialer.endTag( null , "body" );
 
             serialer.startTag( null , "type" );
             String type = cursor.getString( 3 );
             serialer.text(type);
             serialer.endTag( null , "type" );
 
             serialer.endTag( null , "sms" );
             progress++;
 
             //接口的方法
             callBack.callBackprogress(progress);
 
         }
         cursor.close();
         serialer.startTag( null , "info" );
         serialer.endDocument();
         return true ;
     } catch (Exception e) {
         e.printStackTrace();
         return false ;
     }
 
}
}

短信备份常见错误

org.kxml2.io.KXmlSerializer.text(KXmlSerializer.java:536)

这是因为短信的内容中存在着搜狗输入法的一些表情,无法识别,只要把带有表情符号的短信删除掉就可以成功备份

java.io.FileNotFoundException:
/storage/emulated/0/backup.xml: 07-22 10:56:50.440: W/System.err(305): at
open failed: EACCES (Permission denied)

没有权限齐全,短信的读写,sd卡、内存卡的读写权限等

listview的优化:四大原则

1、时间换空间

(牺牲时间换取空间,流的读写)

2、空间换时间

(把文件的路径存进数据库,以后查询就快很多,Android下的图库应用检索)

3、时间换时间

(开机启动速度的优化)

4、空间换空间

把内存换成硬盘,或者把硬盘换成内存

获取手机中所有应用程序的关键信息以List

返回List集合对象

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
     public class AppManagerInfos {
 
     @SuppressWarnings ( "unused" )
     public static List getAppManagerInfos(Context context) {
 
         List appinfos = new ArrayList();
         PackageManager pm = context.getPackageManager();
//获取安装在手机上的应用程序
         List<packageinfo> infos = pm.getInstalledPackages( 0 );
 
         for (PackageInfo appInfo : infos) {
             AppInfo info = new AppInfo();
             // 获得包名
             String packagename = appInfo.packageName;
             info.setPakageName(packagename);
             // 获得应用名称
             String appname = appInfo.applicationInfo.loadLabel(pm).toString();
             info.setAppname(appname);
             // 获得应用图标
             Drawable icon = appInfo.applicationInfo.loadIcon(pm);
             info.setIcon(icon);
             // 获得应用app的绝对路径
             String path = appInfo.applicationInfo.sourceDir;
             info.setPath(path);
             // 获得应用app的大小
             File file = new File(path);
             long size = file.length();
             String sizedata = Formatter.formatFileSize(context, size);
             info.setSize(size);
             int flag = appInfo.applicationInfo.flags;
             if ((flag & ApplicationInfo.FLAG_SYSTEM) == 0 ) {
                 // 用户应用
                 info.setUserapp( true );
             } else {
                 // 系统应用
                 info.setUserapp( false );
             }
             if ((flag & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0 ) {
                 // 存在手机内存
                 info.setInRom( true );
             } else {
                 // 存在sd内存卡
                 info.setInRom( false );
             }
             appinfos.add(info);
         }
         return appinfos;
     }
}
</packageinfo></appinfo></appinfo></appinfo>

把不同集合数据展示到ListView中

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
     public class AppManagerActivity extends Activity {
 
private TextView tv_shji_byte;
private TextView tv_sd_byte;
private ListView lv_listview;
private LinearLayout ll_loading;
private List infos;
private List userapp;
private List systemapp;
private Handler handler = new Handler() {
     public void handleMessage(android.os.Message msg) {
 
         lv_listview.setAdapter( new MyAppManagerAdapter());
         ll_loading.setVisibility(View.INVISIBLE);
     };
};
 
@Override
protected void onCreate(Bundle savedInstanceState) {
     super .onCreate(savedInstanceState);
 
     setContentView(R.layout.activity_app_manager);
 
     tv_shji_byte = (TextView) findViewById(R.id.tv_shji_byte);
     tv_sd_byte = (TextView) findViewById(R.id.tv_sd_byte);
     lv_listview = (ListView) findViewById(R.id.lv_listview);
     ll_loading = (LinearLayout) findViewById(R.id.ll_loading);
 
     userapp = new ArrayList();
     systemapp = new ArrayList();
 
     File datafile = Environment.getDataDirectory();
     long datasize = datafile.getFreeSpace();
 
     File sdfile = Environment.getExternalStorageDirectory();
     long sdsize = sdfile.getFreeSpace();
 
     tv_shji_byte.setText( "手机可用内存"
             + Formatter.formatFileSize( this , datasize));
     tv_sd_byte.setText( "sd卡可用内存" + Formatter.formatFileSize( this , sdsize));
 
     fillData();
 
}
/**
  * 填充数据
  */
private void fillData() {
     new Thread() {
         public void run() {
             infos = AppManagerInfos
                     .getAppManagerInfos(AppManagerActivity. this );
             for (AppInfo info : infos) {
                 if (info.isUserapp()) {
                     // 用户程序
                     userapp.add(info);
                 } else {
                     systemapp.add(info);
                     // 系统程序
                 }
             }
             handler.sendEmptyMessage( 0 );
         };
     }.start();
}
private class MyAppManagerAdapter extends BaseAdapter {
 
     @Override
     public int getCount() {
         return userapp.size() + systemapp.size() + 2 ;
     }
     @Override
     public View getView( int position, View convertView, ViewGroup parent) {
 
         View view;
         HoldView holder;
         if (convertView != null && convertView instanceof RelativeLayout) {
             view = convertView;
             holder = (HoldView) view.getTag();
         } else {
             holder = new HoldView();
             view = View.inflate(AppManagerActivity. this ,
                     R.layout.item_app_manager, null );
             holder.app_name = (TextView) view.findViewById(R.id.app_name);
             holder.app_location = (TextView) view
                     .findViewById(R.id.app_location);
             holder.app_icon = (ImageView) view.findViewById(R.id.app_icom);
             holder.app_size = (TextView) view.findViewById(R.id.app_size);
             view.setTag(holder);
         }
         AppInfo info;
         if (position == 0 ) { // 显示textView用户程序
             TextView tv_user = new TextView(AppManagerActivity. this );
             tv_user.setTextSize( 15 );
             tv_user.setBackgroundColor(Color.GREEN);
             tv_user.setTextColor(Color.BLACK);
             tv_user.setText( "用户程序" + userapp.size() + "个" );
             return tv_user;
         } else if (position == userapp.size() + 1 ) {
             TextView tv_system = new TextView(AppManagerActivity. this );
             tv_system.setTextSize( 15 );
             tv_system.setBackgroundColor(Color.GREEN);
             tv_system.setTextColor(Color.BLACK);
             tv_system.setText( "系统程序" + systemapp.size() + "个" );
             return tv_system;
 
         } else if (position < userapp.size() + 1 ) {
             // 用户程序
             info = userapp.get(position - 1 );
         } else {
             // 系统程序
             info = systemapp.get(position - 2 - userapp.size());
         }
         holder.app_name.setText(info.getAppname());
         holder.app_icon.setImageDrawable(info.getIcon());
         holder.app_size.setText(Formatter.formatFileSize(
                 AppManagerActivity. this , info.getSize()) + "M" );
         if (info.isInRom()) {
             holder.app_location.setText( "手机内存" );
         } else {
             holder.app_location.setText( "sd卡储存" );
         }
         return view;
     }
     @Override
     public Object getItem( int position) {
         return null ;
     }
 
     @Override
     public long getItemId( int position) {
         return 0 ;
     }
 
     private class HoldView {
         TextView app_name;
         TextView app_location;
         ImageView app_icon;
         TextView app_size;
     }
}
</appinfo></appinfo></appinfo></appinfo></appinfo>

设置listview属性可使其快速滚动

?
1
android:fastScrollEnabled= "true"

在listview滚动时悬浮标识符

?
1
2
3
4
5
在帧布局中加入一个TextView
 
 
     <textview android:background= "#00FF00" android:id= "@+id/tv_biaoshi" android:layout_height= "wrap_content" android:layout_width= "match_parent" android:text= "用户程序" android:textcolor= "#000000" android:textsize= "15sp" >
</textview>

不过设置属性时需要和之前区分系统用户时的属性相同,背景色、字体、大小,这样才可以重合

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
TextView tv_biaoshi=(TextView) findViewById(R.id.tv_biaoshi);
/**
  * 给listview注册一个滚动监听器
  */
lv_listview.setOnScrollListener( new OnScrollListener() {
     /**
      * 当状态发生改变时执行此方法
      */
     @Override
     public void onScrollStateChanged(AbsListView view, int scrollState) {
 
     }
     /**
      * 当listview滚动时执行此方法
      */
     @Override
     public void onScroll(AbsListView view, int firstVisibleItem,
             int visibleItemCount, int totalItemCount) {
 
         if (firstVisibleItem>userapp.size()){
             tv_biaoshi.setText( "系统程序" +systemapp.size()+ "个" );
         } else {
             tv_biaoshi.setText( "用户程序" +userapp.size()+ "个" );
         }
     }
});

悬浮窗体的创建使用(轻量级的对话框,内存开销比对话框小,灵活)漂浮的容器,在activity上方

?
1
2
3
4
5
6
7
8
9
10
11
12
13
//点击条目弹出悬浮窗体
     TextView convertView= new TextView(AppManagerActivity. this );
     convertView.setTextSize( 15 );
     convertView.setTextColor(Color.RED);
     convertView.setText(info.getPakageName());
 
     popupwindow = new PopupWindow(convertView, 300 , 100 );
     popupwindow.setBackgroundDrawable( new ColorDrawable(Color.GREEN));
 
     //获取点击的条目view对象到窗体的宽高(左上对齐)存在location中x、y
     int []location= new int [ 2 ];
     view.getLocationInWindow(location);
     popupwindow.showAtLocation(parent, Gravity.TOP+Gravity.LEFT, 80 , location[ 1 ]);

不过一般都是自定义悬浮窗体

?
1
View convertView=View.inflate(getApplicationContext(), R.layout.item_app_popupwindow, null );

布局文件item.app.popupwindow.xml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!--?xml version= "1.0" encoding= "utf-8" ?-->
<linearlayout android:background= "@drawable/tip_bg" android:layout_height= "wrap_content" android:layout_width= "wrap_content" android:orientation= "horizontal" xmlns:android= "http://schemas.android.com/apk/res/android" >
 
<linearlayout android:layout_height= "wrap_content" android:layout_marginleft= "5dp" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:orientation= "vertical" >
 
     <imageview android:layout_height= "wrap_content" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:src= "@drawable/my_user_exit" >
 
     <textview android:layout_height= "wrap_content" android:layout_marginbottom= "3dp" android:layout_width= "wrap_content" android:text= "启动" >
</textview></imageview></linearlayout>
 
<linearlayout android:layout_height= "wrap_content" android:layout_marginleft= "5dp" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:orientation= "vertical" >
 
     <imageview android:layout_height= "wrap_content" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:src= "@drawable/delete" >
 
     <textview android:layout_height= "wrap_content" android:layout_marginbottom= "3dp" android:layout_width= "wrap_content" android:text= "删除" >
</textview></imageview></linearlayout>
 
<linearlayout android:layout_height= "wrap_content" android:layout_marginleft= "5dp" android:layout_width= "wrap_content" android:orientation= "vertical" >
 
     <imageview android:layout_height= "wrap_content" android:layout_width= "wrap_content" android:src= "@drawable/wx_share_friends" >
 
     <textview android:layout_height= "wrap_content" android:layout_marginbottom= "3dp" android:layout_width= "wrap_content" android:text= "分享" >
</textview></imageview></linearlayout>
 
<linearlayout android:layout_height= "wrap_content" android:layout_marginleft= "5dp" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:orientation= "vertical" >
 
     <imageview android:layout_height= "wrap_content" android:layout_margintop= "5dp" android:layout_width= "wrap_content" android:src= "@drawable/datasafety_item_icon_config" >
 
     <textview android:layout_height= "wrap_content" android:layout_marginbottom= "3dp" android:layout_width= "wrap_content" android:text= "信息" >
</textview></imageview></linearlayout>
</linearlayout>

 

?
1
2
3
4
5
6
7
保证窗体中只有一个悬浮窗体,每次弹出前执行判断;listview滚动时消失也执行此方法
 
public void dismissPopupwindow() {
     if (popupwindow!= null && popupwindow.isShowing()){
         popupwindow.dismiss();
         popupwindow= null ;
     }

动画的播放原理

?
1
2
3
4
5
6
确定一个变化的函数:
根据这个函数 动态计算在某个时间应该显示什么画面
 
Canvas Bitmap  要求界面的窗体必须有背景,所以悬浮窗体必须设置背景才能启动动画
 
}

一键分享

?
1
2
3
4
5
6
7
8
9
10
//发送纯文本
Intent intent= new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.addCategory( "android.intent.category.DEFAULT" );
intent.setType( "text/plain" );
//intent.setType("image/*");//图片
//intent.setType("video/*");//音频、视频
//intent.setType("*/*");//所有类型
intent.putExtra(Intent.EXTRA_TEXT, "请使用这款软件" );
startActivity(intent);

一键卸载

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
动态注册广播接收者
 
     innerReceiver= new InnerUninstallAppReceiver();
     IntentFilter filter= new IntentFilter();
     filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
     filter.addDataScheme( "package" );
     registerReceiver(innerReceiver, filter);
 
 
/**
  * 卸载软件程序后需要更新数据注册一个广播接收者
  */
private void uninstallapp() {
 
     if (info.isUserapp()){
         Intent intent= new Intent();
         intent.setAction(Intent.ACTION_DELETE);
         intent.setData(Uri.parse( "package:" +info.getPakageName()));
         startActivity(intent);
         } else {
             ToastUtils.show( this , "应用程序需要root权限才能卸载" );
 
     }
}
/**
  * 内部类,广播接收者,监听软件卸载的事件
  * @author Administrator
  *
  */
private class InnerUninstallAppReceiver extends BroadcastReceiver{
 
     @Override
     public void onReceive(Context context, Intent intent) {
 
         if (info.isUserapp()){
             userapp.remove(info);
         } else {
             systemapp.remove(info);
         }
         adapter.notifyDataSetChanged();
     }
 
}

一键启动软件

?
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
  * 打开软件的功能
  */
public void openApp() {
     PackageManager pm=getPackageManager();
     Intent intent=pm.getLaunchIntentForPackage(info.getPakageName());
     if (intent!= null ){
         startActivity(intent);
     } else {
         ToastUtils.show( this , "软件无法启动!" );
     }
 
}

查看应用程序信息(也可卸载应用程序:系统的设置卸载界面)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
     /**
  * 查看应用程序全部信息
  */
private void showApp() {
     //查找上层应用程序源码
   /*
      <category android:name="android.intent.category.DEFAULT">
      <data android:scheme="package">*/
     Intent intent = new Intent();
     intent.setAction( "android.settings.APPLICATION_DETAILS_SETTINGS" );
     intent.addCategory( "android.intent.category.DEFAULT" );
     intent.setData(Uri.parse( "package:" +info.getPakageName()));
     startActivity(intent);
 
}
</data></category></action>
目录
相关文章
|
8天前
|
Android开发 数据安全/隐私保护 虚拟化
安卓手机远程连接登录Windows服务器教程
安卓手机远程连接登录Windows服务器教程
31 4
|
28天前
|
安全 搜索推荐 Android开发
Android vs. iOS:解锁智能手机操作系统的奥秘####
【10月更文挑战第21天】 在当今这个数字化时代,智能手机已成为我们生活中不可或缺的伙伴。本文旨在深入浅出地探讨两大主流操作系统——Android与iOS的核心差异、优势及未来趋势,帮助读者更好地理解这两个平台背后的技术哲学和用户体验设计。通过对比分析,揭示它们如何塑造了我们的数字生活方式,并展望未来可能的发展路径。无论您是技术爱好者还是普通用户,这篇文章都将带您走进一个充满创新与可能性的移动世界。 ####
49 3
|
1月前
|
Ubuntu Linux Android开发
termux+anlinux+Rvnc viewer来使安卓手机(平板)变成linux服务器
本文介绍了如何在Android设备上安装Termux和AnLinux,并通过这些工具运行Ubuntu系统和桌面环境。
136 2
termux+anlinux+Rvnc viewer来使安卓手机(平板)变成linux服务器
|
30天前
|
Android开发
Android面试高频知识点(1) 图解Android事件分发机制
Android面试高频知识点(1) 图解Android事件分发机制
|
30天前
|
消息中间件 存储 Java
Android面试高频知识点(2) 详解Android消息处理机制(Handler)
Android面试高频知识点(2) 详解Android消息处理机制(Handler)
|
30天前
|
XML 前端开发 Android开发
Android面试高频知识点(3) 详解Android View的绘制流程
Android面试高频知识点(3) 详解Android View的绘制流程
Android面试高频知识点(3) 详解Android View的绘制流程
|
1月前
|
消息中间件 Android开发 索引
Android面试高频知识点(4) 详解Activity的启动流程
Android面试高频知识点(4) 详解Activity的启动流程
27 3
|
1月前
|
XML 前端开发 Android开发
Android面试高频知识点(3) 详解Android View的绘制流程
Android面试高频知识点(3) 详解Android View的绘制流程
25 2
|
1月前
|
消息中间件 存储 Java
Android面试高频知识点(2) 详解Android消息处理机制(Handler)
Android面试高频知识点(2) 详解Android消息处理机制(Handler)
53 1
|
1月前
|
Android开发
Android面试高频知识点(1) 图解 Android 事件分发机制
Android面试高频知识点(1) 图解 Android 事件分发机制
39 1
下一篇
无影云桌面