2012-03-24 19 views
0
please see the below code 
     //here i call the gallery view 
     Gallery g = (Gallery) findViewById(R.id.gallery); 
      g.setAdapter(new ImageAdapter(this, json)); 

     //image adapter class 
     public class ImageAdapter extends BaseAdapter { 
    Bitmap bmp; 
      private ImageView[] mImages; 
      String[] itemimage; 

     public ImageAdapter(Context context, JSONArray imageArrayJson) { 
     this.mImages = new ImageView[imageArrayJson.length()]; 
     String qrimage; 
     try 
     { 
     private Image View[] mImages; 
     for (int i = 0; i < imageArrayJson.length(); i++) { 
     JSONObject image = imageArrayJson.getJSONObject(i); 
     qrimage = image.getString("itemimage"); 


     byte[] qrimageBytes = Base64.decode(qrimage.getBytes()); 

     bmp = BitmapFactory.decodeByteArray(qrimageBytes, 
              0, 
              qrimageBytes.length); 
     mImages[i] = new ImageView(context); 

     mImages[i].setImageBitmap(bmp); 

     my xml view 
     <Gallery xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/gallery" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
/> 

我可以通過使用json的url查看圖像,我可以在圖庫佈局中獲得。我想獲得相同的數據到listview.please幫我如何將imageview傳遞到列表視圖android

我得到所有的JSON數據使用URL到Android我在這裏傳遞圖像適配器類在這裏畫廊視圖可以出現使用畫廊..我想要vew圖像畫廊列表

回答

0

您需要編寫一個自己的適配器。 而且你必須爲ListView項目

提供一個自己的佈局也許這次討論給一個印象

Custom ListView adapter, strange ImageView behavior

或者本教程

http://www.vogella.de/articles/AndroidListView/article.html

+0

我可以顯示在庫中的所有圖片查看我想查看列表視圖中的所有圖像 – 2012-03-24 16:17:23

+0

請參閱上面的代碼我如何通過列表視圖請幫助我 – 2012-03-24 16:29:02

+0

我不'不要以爲你的代碼可以工作。也許你會檢查與教程鏈接 – 2012-03-24 16:44:21

相關問題