2011-03-01 53 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);