I am getting this error in my console.
UIL doesn't support scheme(protocol) by default ["http://mywebsite.com/mylocation/image.jpg"]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
I am trying to load images from my website into an android application. Steps followed: In build.gradle
dependencies {compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'}
In AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
This is the json output I am getting:
"image":"\"http:\\\/\\\/mywebsite.com\\\/mylocation\\\/image.jpg\""
In my ApplicationActivity.java
ImageView myImage
myImage = (ImageView)findViewById(R.id.image_id);
I tried stripping the url of all unnecessary parameters as below:
imageUrl = url.replaceAll("\\[]\"", "");
imageUrl = imageUrl.replace("\\/","/");
This is the code in ApplicationActivity.java that I used to try and load the image using UniversalImageLoader:
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
//
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.defaultDisplayImageOptions(defaultOptions)
.build();
ImageLoader.getInstance().init(config);
Toast.makeText(single_event.this, imageUrl, Toast.LENGTH_LONG).show();
if(imageUrl != null) {
//Sets Image
ImageLoader.getInstance().displayImage(imageUrl, myImage);
}
Log.d("URL", imageUrl);
The console log and the toast both return the correct url in quotes "http://mywebsite.com/mylocation/image.jpg"
Is there some configuration or setup i have missed?
Is there anything extra I hould do after ImageLoader.getInstance().displayImage(imageUrl, myImage);
?
Please assist.
[Edit] This is the layout (below). If I specify the image source in the layout to be an image in drawable, then the image is loaded from the phone and all the java logic is ignored. If I remove the source, then nothing happens
<ImageView
android:layout_width="fill_parent"
android:layout_height="120dp"
android:id="@+id/image_id"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:contentDescription="@string/cnt"
android:src="@drawable/local_placeholder"
/>
imageUrl = imageUrl.substring(1, imageUrl.length()-1);
to remove the quotes from "http://mywebsite.com/mylocation/image.jpg" solved the problem.