我将图像作为编码方法上传到服务器Base64
,它作为字符串发送我可以从服务器检索该字符串并解码它们
问问题
571 次
2 回答
0
you have link for that..json parsing ,xml parsing u can get the address and then u can implement that image in ur apps.
于 2013-07-15T12:04:09.987 回答
0
<?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 from 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 - will be shown before loading image
int loader = R.drawable.loader;
// Imageview to 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 you want to load an image from url
// call DisplayImage function
// url - image url to load
// loader - loader image, will be displayed before getting image
// image - ImageView
imgLoader.DisplayImage(image_url, loader, image);
}
}
<!-- Internet Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permission to write to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
于 2013-07-16T05:03:48.193 回答