获得android系统上所有程序的列表,的源代码 各位,我想实现一个功能,就是获得android手机系统的所有应用程序的列表,并显示出来。请问,谁有类似的源代码,发给我看看,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个太多了baidu一大堆。算了,给我的代码你看看 * Method name: dealLauncher<BR> * Method description: 显示Dialog[启动应用程序]<BR> * */ private void dealLauncher(){ ImageView appViewBtn= (ImageView)this.findViewById(R.id.ss_02_04_img02); appViewBtn.setOnClickListener(new OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub // 1. init UI Context context=v.getContext(); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = mInflater.inflate(R.layout.view, null); LinearLayout layout=(LinearLayout)view.findViewById(R.id.LinearLayout01); ListView listView=new ListView(context); // listView.setDividerHeight(2); listView.setCacheColorHint(0); // 2.upLoad data listView.setAdapter(new LauncherAdapter(v.getContext(), getLaunchers())); listView.setItemsCanFocus(false); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); layout.addView(listView); // 3. show UI new AlertDialog.Builder(context) .setTitle(R.string.schedule_set_activity_choose_application)//"启动程序设置" .setView(view) .setPositiveButton(R.string.common_ok, //"确定" new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if(launcherItem != null){ TextView textView02 = (TextView) ScheduleSetActivity.this.findViewById(R.id.ss_02_04_textView02); textView02.setText(launcherItem.label); } } }) .setNegativeButton(R.string.common_cancel, // "取消" new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { launcherItem = null; } }) .show(); } }); }/** * Class name:LauncherAdapter * Class description:应用程序对应的适配器<BR> * @version 1.00 2011/03/01 * @author XXX */ private class LauncherAdapter extends BaseAdapter { private LayoutInflater mInflater; private ArrayList<LauncherItem> dataSource; public LauncherAdapter(Context context, ArrayList<LauncherItem> dataSource){ this.mInflater = LayoutInflater.from(context); this.dataSource = dataSource; } public int getCount() { // TODO Auto-generated method stub return dataSource.size(); } public Object getItem(int arg0) { // TODO Auto-generated method stub return arg0; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public boolean isEnabled(int position) { return false; } public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder=null; if(convertView == null){ holder=new ViewHolder(); convertView=mInflater.inflate(R.layout.list_item_001,null); holder.imageView=(ImageView) convertView.findViewById(R.id.li001_img001); holder.textView = (TextView) convertView.findViewById(R.id.li001_tv001); holder.radioBtn = (RadioButton) convertView.findViewById(R.id.li001_rb001); convertView.setTag(holder); }else { holder = (ViewHolder)convertView.getTag(); } holder.imageView.setImageDrawable(dataSource.get(position).icon); holder.textView.setText(dataSource.get(position).label); holder.radioBtn.setOnClickListener(new SingleChoiceListener(position)); holder.radioBtn.setChecked(dataSource.get(position).checked); return convertView; } 我们可以用PackageManager来显示系统安装的应用程序列表或者系统程序列表http://www.iteye.com/topic/1114025 我用的这个:http://www.linuxidc.com/Linux/2011-09/42287.htm Android如何实现程序搬家 求助各路大神!!!!apk签名 android 同时弹出 Dialog 和软件盘 gps定位2.2上运行良好2.3不行 android 调用本地图片默认从媒体库进入而不是文件浏览器 android上的应用问题:(以下代码通不过) android以后做那个方面会好混点,有前途点呀? 安卓X864.3,配27寸显示屏,如何全屏显示 List添加对象,循环读取出错 关于Canvas: trying to use a recycled bitmap android.graphics的疑惑 flash文件在android 2.0的屏上能不能显示 手机和电脑通信
算了,给我的代码你看看
* Method name: dealLauncher<BR>
* Method description: 显示Dialog[启动应用程序]<BR>
*
*/
private void dealLauncher(){
ImageView appViewBtn= (ImageView)this.findViewById(R.id.ss_02_04_img02);
appViewBtn.setOnClickListener(new OnClickListener(){ public void onClick(View v) {
// TODO Auto-generated method stub
// 1. init UI
Context context=v.getContext();
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = mInflater.inflate(R.layout.view, null);
LinearLayout layout=(LinearLayout)view.findViewById(R.id.LinearLayout01);
ListView listView=new ListView(context);
// listView.setDividerHeight(2);
listView.setCacheColorHint(0);
// 2.upLoad data
listView.setAdapter(new LauncherAdapter(v.getContext(), getLaunchers()));
listView.setItemsCanFocus(false);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
layout.addView(listView); // 3. show UI
new AlertDialog.Builder(context)
.setTitle(R.string.schedule_set_activity_choose_application)//"启动程序设置"
.setView(view)
.setPositiveButton(R.string.common_ok, //"确定"
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(launcherItem != null){
TextView textView02 = (TextView) ScheduleSetActivity.this.findViewById(R.id.ss_02_04_textView02);
textView02.setText(launcherItem.label);
}
}
})
.setNegativeButton(R.string.common_cancel, // "取消"
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
launcherItem = null;
}
})
.show();
}
});
}/**
* Class name:LauncherAdapter
* Class description:应用程序对应的适配器<BR>
* @version 1.00 2011/03/01
* @author XXX
*/
private class LauncherAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private ArrayList<LauncherItem> dataSource; public LauncherAdapter(Context context, ArrayList<LauncherItem> dataSource){
this.mInflater = LayoutInflater.from(context);
this.dataSource = dataSource;
}
public int getCount() {
// TODO Auto-generated method stub
return dataSource.size();
}
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public boolean isEnabled(int position) {
return false;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder=null;
if(convertView == null){
holder=new ViewHolder();
convertView=mInflater.inflate(R.layout.list_item_001,null);
holder.imageView=(ImageView) convertView.findViewById(R.id.li001_img001);
holder.textView = (TextView) convertView.findViewById(R.id.li001_tv001);
holder.radioBtn = (RadioButton) convertView.findViewById(R.id.li001_rb001);
convertView.setTag(holder); }else {
holder = (ViewHolder)convertView.getTag();
}
holder.imageView.setImageDrawable(dataSource.get(position).icon);
holder.textView.setText(dataSource.get(position).label);
holder.radioBtn.setOnClickListener(new SingleChoiceListener(position));
holder.radioBtn.setChecked(dataSource.get(position).checked);
return convertView;
}