mehrdad.h
دوشنبه 03 خرداد 1395, 00:13 صبح
سلام دوستان عزیز
من تو برنامم یه listview سفارش دارم که هم متن داره هم عکس منتها متنو نمایش میده ولی عکسو نمایش نمیده و کرش میکنه از برنامه
کد رو براتون میزارم ممنون میشم راهنماییم کنید (در ضمن عکس ها از پوشه assets باید خونده بشن ) همین کدو واسه gridview استفاده میکنم جواب میده
public View getView(final int position, View convertView, ViewGroup parent) {
final LayoutInflater in=getLayoutInflater();
View row=in.inflate(R.layout.list_item, parent,false);
final TextView name=(TextView)row.findViewById(R.id.txt1);
name.setText(Name[position]);
String fileName=img[position];
ImageView iw= (ImageView)findViewById(R.id.img1);
AssetManager assetManager = getAssets();
InputStream istr = null;
try {
istr = assetManager.open(fileName);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(istr);
iw.setImageBitmap(bitmap);
return row;
}
من تو برنامم یه listview سفارش دارم که هم متن داره هم عکس منتها متنو نمایش میده ولی عکسو نمایش نمیده و کرش میکنه از برنامه
کد رو براتون میزارم ممنون میشم راهنماییم کنید (در ضمن عکس ها از پوشه assets باید خونده بشن ) همین کدو واسه gridview استفاده میکنم جواب میده
public View getView(final int position, View convertView, ViewGroup parent) {
final LayoutInflater in=getLayoutInflater();
View row=in.inflate(R.layout.list_item, parent,false);
final TextView name=(TextView)row.findViewById(R.id.txt1);
name.setText(Name[position]);
String fileName=img[position];
ImageView iw= (ImageView)findViewById(R.id.img1);
AssetManager assetManager = getAssets();
InputStream istr = null;
try {
istr = assetManager.open(fileName);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(istr);
iw.setImageBitmap(bitmap);
return row;
}