2011-03-01 54 views
1

我需要创建视频的列表视图与它的缩略图images.The图像名称来自数据库。我可以给textview的价值,但当试图给图像视图价值它也崩溃位图android:缩略图列表视图

 class CustomSimpleCusorAdapter extends SimpleCursorAdapter{ 
    private Context context; 
    private int layout; 
    //TextView title; 
    public CustomSimpleCusorAdapter(Context context, int layout, Cursor c, 
      String[] from, int[] to) { 

     super(context, layout, c, from, to); 
     // TODO Auto-generated constructor stub 
     this.layout=layout; 
     this.context =context; 

    } 

public View newView(Context context, Cursor cursor, ViewGroup parent) { 

    LayoutInflater inflater = LayoutInflater.from(context); 
     View view = inflater.inflate(layout, parent, false); 

    return view; 
    } 
@Override 
public void bindView(View v, Context context, Cursor c) { 

    Log.d("DATABAT",c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.VIDEO_TITLE))); 
    Log.d("DATABAT",c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.VIDEO_IMAGE))); 

    TextView section_text = (TextView) v.findViewById(R.id.title); 
    section_text.setText(c.getString(c.getColumnIndexOrThrow(NotesDbAdapter.VIDEO_TITLE))); 
    ImageView thumb =(ImageView)findViewById(R.id.icon); 
    //   
    String filename = "flag_1"; 
     int id = context.getResources().getIdentifier(filename, "drawable", context.getString(R.string.package_str)); 
    Log.d("ID",""+id); 

    thumb.setBackgroundResource(R.drawable.menuicon); 

} 

} 

感谢

回答

1

好了...轻轻踩这里,但是这听起来酷似问题试图显示缩略图f出现我哥们了或者他的视频应用......

下面是一个Encode/Decode tutorial for base64

而且仅作参考;这里是他在市场上的应用程序链接(300,000+次下载):Video Player

1

试试这个地方

String urldisplay=img_value.toString(); 
InputStream in = new java.net.URL(urldisplay).openStream(); 
mIcon11 = BitmapFactory.decodeStream(new PatchInputStream(in)); 
mIcon11=ImageHelper.getRoundedCornerBitmap(mIcon11,30); 
holder.icon.setImageBitmap(mIcon11);