FileDocCategorySizeDatePackage
InstrumentationList.javaAPI DocAndroid 1.5 API6189Wed May 06 22:41:08 BST 2009com.android.development

InstrumentationAdapter

public 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 voidbindView(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 intgetCount()

        return mList != null ? mList.size() : 0;
    
public java.lang.ObjectgetItem(int position)

        return position;
    
public longgetItemId(int position)

        return position;
    
public android.view.ViewgetView(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.ComponentNameinstrumentationForPosition(int position)

        if (mList == null) {
            return null;
        }
        InstrumentationInfo ii = mList.get(position);
        return new ComponentName(ii.packageName, ii.name);