i uploaded image server base64
encoded method , send string can retrieve string server , decode them
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="loading image url" android:layout_margin="10dip" /> <imageview android:id="@+id/image" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_margin="10dip"/> </linearlayout> public class loadimagefromurlactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // loader image - shown before loading image int loader = r.drawable.loader; // imageview show imageview image = (imageview) findviewbyid(r.id.image); // image url string image_url = "http://images4.fanpop.com/image/photos/18900000/cute-couples-_-love-18948423-500-334.jpg"; // imageloader class instance imageloader imgloader = new imageloader(getapplicationcontext()); // whenever want load image url // call displayimage function // url - image url load // loader - loader image, displayed before getting image // image - imageview imgloader.displayimage(image_url, loader, image); } } <!-- internet permissions --> <uses-permission android:name="android.permission.internet" /> <!-- permission write external storage --> <uses-permission android:name="android.permission.write_external_storage" />
Comments
Post a Comment