在类A中生成覆盖方法onCreateDialog扩展了ArrayAdapter <media>

时间:2017-09-29 04:28:04

标签: android

我有一个类A,它扩展了ArrayAdapter,如下所示:

public class A extends ArrayAdapter<Media>{

Context context;
int layoutResourceId;
Media data[] = null;

public Media_adapter(Context context, int layoutResourceId, Media[] data) {
    super(context, layoutResourceId, data);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.data = data;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    MediaHolder holder = null;

    if(row == null)
    {
        LayoutInflater inflater = ((Activity)context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);

        holder = new MediaHolder();
        holder.item_listview = (TextView)row.findViewById(R.id.item_listview);

        row.setTag(holder);

    }
    else
    {
        holder = (MediaHolder)row.getTag();
    }

    Media media = data[position];
    holder.item_listview.setText(media.item_listview);

    return row;
}

static class MediaHolder
{
    TextView item_listview;
}

}

我想要生成覆盖方法 onCreateDialog ,但它不在列表中!!

@Override
protected Dialog onCreateDialog(int id) {
    //
}

虽然我可以在Activity中覆盖它! 是否有覆盖此方法的解决方案?

0 个答案:

没有答案