У меня есть арарист пользовательского объекта (NewsFeedObj). Я хотел бы заполнить список, используя переменные в NewsFeedObj. Когда я запускаю код, я получаю пустой экран. Что не так?Заполнение списка с помощью настраиваемого объекта
class Sadapter extends ArrayAdapter<NewsFeedObj>
{
Context context;
int j;
NewsFeedObj o = new NewsFeedObj();
ArrayList<NewsFeedObj> l;
public Sadapter(Context context,int i,ArrayList<NewsFeedObj> g)
{
super(context,i,g);
this.context=context;
this.l=g;
this.j=i;
// TODO Auto-generated constructor stub
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row=inflater.inflate(R.layout.newfeed_layout,parent,false);
//row.findViewById(id)
TextView Text=(TextView) row.findViewById(R.id.Description);
o=l.get(position);
Text.setText(o.get_description());
return row;
}
}
показать свой код, где вы установилиAdapter() – QuokMoon
ListView lis = (ListVi ЭВ) findViewById (R.id.list); Sadapter A = новый Sadapter (это, R.layout.newfeed_layout, NewsObjs); lis.setAdapter (A); –