如何在android惰性列表应用程序中使用字节imag []数组而不是字符串mString []数组
我是新开发人员,我想在示例应用程序中使用惰性列表概念。在 Lazy List 应用程序中,开发人员使用了已将 url 转换为位图的 url。但我想使用位图编码的字符串数组。编码后的字符串数组已使用 Base64.java 转换为字节数组。我想使用字节数组而不是网址。 在惰性列表应用程序中,他们使用字符串数组作为:
private String[] mStrings={"url1","url2","url3","url4","url5"};
在我的示例应用程序中,我使用字节数组作为:
byte[] imgArry= Base64.decode(photoInfo);
Bitmap bit=BitmapFactory.decodeByteArray(imgArry,0,imgArry.length);
profileImageView.setImageBitmap(bit);
从上面的代码中,我想将 byte[] imgArry 而不是 String[] mStrings 传递到:
adapter=new LazyAdapter(this, imgArry);
如何使用 byte [] 数组而不是 String[] mStrings?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
向 LazyAdapter 类添加一个新的构造函数,该构造函数接受 byte[] 作为第二个参数。
如果您这样做,您可以直接编辑 LazyAdapter 类,或者简单地创建一个带有将位图或 byte[] 作为第二个参数的构造函数的子类。
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.