android获取正在运行的应用程序
2012-12-18 13:59:24 来源:WEB开发网核心提示: //下面这个方法主要是用来刷新图片,因为pInfo.getInfo(runningTasks.get(i).processName).loadIcon(pm)获得图片不能被显示出 listadapter.setViewBinder(new ViewBinder(){ public bool
//下面这个方法主要是用来刷新图片,因为pInfo.getInfo(runningTasks.get(i).processName).loadIcon(pm)获得图片不能被显示出
listadapter.setViewBinder(new ViewBinder(){
public boolean setViewValue(View view,Object data,String textRepresentation){
if(view instanceof ImageView && data instanceof Drawable){
ImageView iv=(ImageView)view;
iv.setImageDrawable((Drawable)data);
return true;
}
else
return false;
}
});
public boolean setViewValue(View view,Object data,String textRepresentation){
if(view instanceof ImageView && data instanceof Drawable){
ImageView iv=(ImageView)view;
iv.setImageDrawable((Drawable)data);
return true;
}
else
return false;
}
});
//为listView添加item的点击事件
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
//get the item of the list to a hashmap
HashMap<?, ?> map=(HashMap<?, ?>)parent.getItemAtPosition(position);
//get package name from map
String packageName=(String) map.get("packagename");//从前面的map中获得包名
//if we onclick the item then start the application
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
//get the item of the list to a hashmap
HashMap<?, ?> map=(HashMap<?, ?>)parent.getItemAtPosition(position);
//get package name from map
String packageName=(String) map.get("packagename");//从前面的map中获得包名
//if we onclick the item then start the application
更多精彩
赞助商链接