我从我的虚拟主机中获取了我的图片。但是我的listview没有显示我上传的图像,即使数据库中存在正确的路径。
UIL doesn't support scheme(protocol) by default [carkila.esy.es/upload/20160727155302300500.jpeg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [carkila.esy.es/upload/20160727155302300500.jpeg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:280)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:99)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
以下是我将图片上传到我的虚拟主机的方式
@Override
public void onClick(View v) {
try {
bitmap = ImageLoader.init().from(selectedPhoto).requestSize(1024,1024).getBitmap();
String encodeImage = ImageBase64.encode(bitmap);
Log.d(TAG, encodeImage);
HashMap<String,String> post = new HashMap<String,String>();
post.put("image",encodeImage);
PostResponseAsyncTask taskUpload = new PostResponseAsyncTask(InsertActivity.this, post, new AsyncResponse() {
@Override
public void processFinish(String s) {
Log.d(TAG, s);
if(s.contains("upload_success")){
Toast.makeText(getApplicationContext(),"Image Upload Success",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(),"Error Uploading",Toast.LENGTH_SHORT).show();
}
}
});
taskUpload.execute("http://carkila.esy.es/upload1.php");
这就是我在Listview上打印的方式。
dict.addDynamicImageField(R.id.ivImg, new StringExtractor<Cars>() {
@Override
public String getStringValue(Cars product, int position) {
return product.Image;
}
}, new DynamicImageLoader() {
@Override
public void loadImage(String url, ImageView imageView) {
ImageLoader.getInstance().displayImage(url, imageView); // Default options will be used
}
});
谢谢你