how to use byte imag[] array instead of string mString[] array in android lazy list application

StackOverflow https://stackoverflow.com/questions/7331179

  •  27-10-2019
  •  | 
  •  

Question

I am new developer I would like to use lazy list concept in a sample application. In Lazy List application the developers has used an url that url has converted in to Bitmap. But I would like to use bitmap encoded string array. The encoded string array has converted in to byte array by using Base64.java. I would like to use the byte array instead of url. In lazy list application they have used a string array as :

      private String[] mStrings={"url1","url2","url3","url4","url5"};

In my sample application I have used a byte array as:

         byte[] imgArry= Base64.decode(photoInfo);                  
            Bitmap bit=BitmapFactory.decodeByteArray(imgArry,0,imgArry.length);     
            profileImageView.setImageBitmap(bit);

From the above code I would like to pass byte[] imgArry instead of String[] mStrings to:

        adapter=new LazyAdapter(this, imgArry);

How can I use byte[] array instead of String[] mStrings?

Was it helpful?

Solution

Add a new constructor to your LazyAdapter class that accepts byte[] as the second parameter.

If you are doing this you could either directly edit the LazyAdapter class or simply create a subclass with a constructor that takes the bitmap or byte[] as the second paramter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top