InstrumentationAdapterpublic class InstrumentationAdapter extends android.widget.BaseAdapter
Fields Summary |
---|
private android.content.pm.PackageManager | mPM | protected final android.content.Context | mContext | protected final String | mTargetPackage | protected final android.view.LayoutInflater | mInflater | protected List | mList |
Constructors Summary |
---|
public InstrumentationAdapter(android.content.Context context, String targetPackage)
mContext = context;
mTargetPackage = targetPackage;
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPM = context.getPackageManager();
mList = context.getPackageManager().queryInstrumentation(mTargetPackage, 0);
if (mList != null) {
Collections.sort(mList, new InstrumentationInfo.DisplayNameComparator(mPM));
}
|
Methods Summary |
---|
private final void | bindView(android.view.View view, android.content.pm.InstrumentationInfo info)
TextView text = (TextView)view.findViewById(android.R.id.text1);
CharSequence label = info.loadLabel(mPM);
text.setText(label != null ? label : info.name);
| public int | getCount()
return mList != null ? mList.size() : 0;
| public java.lang.Object | getItem(int position)
return position;
| public long | getItemId(int position)
return position;
| public android.view.View | getView(int position, android.view.View convertView, android.view.ViewGroup parent)
View view;
if (convertView == null) {
view = mInflater.inflate(
android.R.layout.simple_list_item_1, parent, false);
} else {
view = convertView;
}
bindView(view, mList.get(position));
return view;
| public android.content.ComponentName | instrumentationForPosition(int position)
if (mList == null) {
return null;
}
InstrumentationInfo ii = mList.get(position);
return new ComponentName(ii.packageName, ii.name);
|
|