2 my future my dream My_Future_My_Dream 于 2014.04.24 08:52 提问

AppWidget中实现listview,如何进行listview的优化

public RemoteViews getViewAt(int position)
{
Log.i("APP", "getViewAt");
if (position < 0 || position >= getCount()) { return null; }
getAllApps(mContext);

PackageInfo res = apps.get(position);

views = new RemoteViews(mContext.getPackageName(), R.layout.layout_item);
views.setTextViewText(R.id.name, mPackageManager.getApplicationLabel(res.applicationInfo));
views.setImageViewBitmap(R.id.icon, drawableToBitmap(mPackageManager.getApplicationIcon(res.applicationInfo)));

mPackageManager = mContext.getPackageManager();
Intent intent1 = new Intent(Intent.ACTION_MAIN, null);
intent1.addCategory(Intent.CATEGORY_LAUNCHER);
String pkg = res.packageName;

Bundle extras = new Bundle();
// extras.putInt("page",1);
extras.putInt(MyWidgetService.EXTRA_ITEM, position);
extras.putString("pkg", pkg);
Intent fillInIntent = new Intent();
fillInIntent.putExtras(extras);

views.setOnClickFillInIntent(R.id.item, fillInIntent);

return views;

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!