NOSC, спасибо за ответ! я так и сделал ,картинки внес в drawable ,а данные в таблицу внес
Добавлено через 3 часа 45 минут
сделал вот так,но что то с ошибкой закрывается
Java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| @Override
public int getCount() {
// TODO Auto-generated method stub
return 3;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ToDoDatabase hel = new ToDoDatabase(mContext);
SQLiteDatabase db = hel.getWritableDatabase();
String query = "SELECT " + ToDoDatabase.IMAGE + " FROM " + ToDoDatabase.TABLE_NAME;
Cursor c = db.rawQuery(query, null);
ImageView imageView = new ImageView(mContext);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(90, 90));
imageView.setImageResource(mContext.getResources().getIdentifier(c.getString(c.getColumnIndex(ToDoDatabase.IMAGE)),
"drawable", mContext.getPackageName()));
return imageView;
} |
|