title: How to retrieve Images from firebase in listview
body: <p>I trying to retrieve images in listview using Firebase list adapter.I am using POJO class for saving and retriving images from firebase.</p>
  
  <p>Below is my POJO class: Data.java</p>
  
  <pre><code>public class Data {
  
  String imag;
  
  public Data(){
  
  }
  
  public Data(String imag){
  
      this.imag = imag;
  }
  
  public String getImag() {
      return imag;
  }
  
  public void setImag(String imag) {
      this.imag = imag;
    }
  }
  </code></pre>
  
  <p>Code for storing images:</p>
  
  <pre><code> Firebase ref = new Firebase("https://imaglist.firebaseio.com");
  
   Bitmap bm = BitmapFactory.decodeFile(imgDecodableString);
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
   byte[] byteArray = baos.toByteArray();
   encodedImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
  
            Data d = new Data();
  
            d.setImag(encodedImage);
  
   ref.child("Photo").push().setValue(d, new Firebase.CompletionListener() {
  
       @Override
       public void onComplete(FirebaseError firebaseError, Firebase firebase) {       
   if(firebaseError != null){
                                     Toast.makeText(getApplicationContext(),firebaseError.getMessage(),Toast.LENGTH_SHORT).show();
                                }
                                else{
                                    Toast.makeText(getApplicationContext(),"Image Saved",Toast.LENGTH_SHORT).show();
                                }
                            }
                        }); 
  </code></pre>
  
  <p>Code for retriving Images:</p>
  
  <pre><code>list  = (ListView)findViewById(R.id.list);
  img = (ImageView)findViewById(R.id.img);
  
   FirebaseListAdapter&lt;Data&gt; ad = new FirebaseListAdapter&lt;Data&gt;(MainActivity.this,Data.class,R.layout.row,ref) {
          @Override
          protected void populateView(View view, Data data, int i) {
  
              Data d = new Data();
  
              byte[] dec = Base64.decode(encodedImage,Base64.DEFAULT);
              Bitmap decodeByte = BitmapFactory.decodeByteArray(dec, 0, dec.length);
              img.setImageBitmap(decodeByte);
  
          }
      };
                list.setAdapter(ad);
  </code></pre>
  
  <p>how to set getter in firebase list adapter to fetch images.</p>