private class MyAdapter extends ArrayAdapter<String>{
public MyAdapter(Context context, int resource, int textViewResourceId,
String[] strings) {
super(context, resource, textViewResourceId, strings);
// TODO Auto-generated constructor stub
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.list_item, parent, false);
String stringName = "string_key_" + String.valueOf(position+1);
int string_res_ID = getResources().getIdentifier(stringName,"string",getPackageName());
String my_string = getResources().getString(string_res_ID);
TextView tv = (TextView) row.findViewById(R.id.textView1);
tv.setText(my_string);
String imageName = "key_" + String.valueOf(position+1);
int image_res_ID = getResources().getIdentifier(imageName,"drawable",getPackageName());
ImageView iv = (ImageView) row.findViewById(R.id.imageView1);
iv.setImageResource(image_res_ID);
return row;
}
}