网友通过本文主要向大家介绍了360手机安全卫士,360手机安全卫士下载,360手机安全卫士官网,手机安全卫士排行榜,手机安全卫士哪个好等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
手机安全卫士——软件管理-用户程序和系统程序,安全卫士系统程序
首先看一下界面:
AppManagerActivity .java
//软件管理 public class AppManagerActivity extends Activity implements View.OnClickListener{ List<AppInfo> appinfos; ListView lv; private List<AppInfo> userAppInfos; private List<AppInfo> systemAppInfos; private TextView tv_app; private PopupWindow popupWindow; private AppInfo clickAppInfo; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); initUI(); initData(); } @Override public void onClick(View v) { switch (v.getId()) { //分享 case R.id.ll_share: Intent share_localIntent = new Intent("android.intent.action.SEND"); share_localIntent.setType("text/plain"); share_localIntent.putExtra("android.intent.extra.SUBJECT", "f分享"); share_localIntent.putExtra("android.intent.extra.TEXT", "Hi!推荐您使用软件:" + clickAppInfo.getApkname()+"下载地址:"+"https://play.google.com/store/apps/details?id="+clickAppInfo.getApkPackageName()); this.startActivity(Intent.createChooser(share_localIntent, "分享")); popupWindowDismiss(); break; //运行 case R.id.ll_start: Intent start_localIntent = this.getPackageManager().getLaunchIntentForPackage(clickAppInfo.getApkPackageName()); this.startActivity(start_localIntent); popupWindowDismiss(); break; //卸载 case R.id.ll_uninstall: Intent uninstall_localIntent = new Intent("android.intent.action.DELETE", Uri.parse("package:" + clickAppInfo.getApkPackageName())); startActivity(uninstall_localIntent); popupWindowDismiss(); break; //详情 case R.id.ll_detail: Intent detail_intent = new Intent(); detail_intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); detail_intent.addCategory(Intent.CATEGORY_DEFAULT); detail_intent.setData(Uri.parse("package:" + clickAppInfo.getApkPackageName())); startActivity(detail_intent); break; } } private class AppManagerAdapter extends BaseAdapter{ @Override public int getCount() { // TODO Auto-generated method stub return userAppInfos.size() + 1 + systemAppInfos.size() + 1; } @Override public Object getItem(int position) { // TODO Auto-generated method stub if (position == 0) { return null; } else if (position == userAppInfos.size() + 1) { return null; } AppInfo appInfo; if (position < userAppInfos.size() + 1) { //把多出来的特殊的条目减掉 appInfo = userAppInfos.get(position - 1); } else { int location = userAppInfos.size() + 2; appInfo = systemAppInfos.get(position - location); } return appInfo; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) {
//特殊条目的处理 //如果当前的position等于0 表示应用程序 if (position == 0) { TextView textView = new TextView(AppManagerActivity.this); textView.setTextColor(Color.WHITE); textView.setBackgroundColor(Color.GRAY); textView.setText("用户程序(" + userAppInfos.size() + ")"); return textView; //表示系统程序 } else if (position == userAppInfos.size() + 1) { TextView textView = new TextView(AppManagerActivity.this); textView.setTextColor(Color.WHITE); textView.setBackgroundColor(Color.GRAY); textView.setText("系统程序(" + systemAppInfos.size() + ")"); return textView; } AppInfo appInfo; if (position < userAppInfos.size() + 1) { //把多出来的特殊的条目减掉 appInfo = userAppInfos.get(position - 1); } else { int location = userAppInfos.size() + 2; appInfo = systemAppInfos.get(position - location); } View view = null; ViewHolder holder; if (convertView != null && convertView instanceof LinearLayout) { view = convertView; holder = (ViewHolder) view.getTag(); } else { view = View.inflate(AppManagerActi