[英]load image url into editText
I need to insert a URL Image into EditText and able to save it to my Mysql . 我需要将URL图像插入EditText并将其保存到Mysql中 。
Here my code for browsing the list of images into my local server : 这是我的代码,用于将图像列表浏览到本地服务器中:
checkButton=(Button) findViewById(R.id.browser);
checkButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String url = "http://10.0.2.2/images/";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
if you have URL for image, then you can retrieve Bitmap for image from server. 如果您有图像的URL,则可以从服务器检索图像的位图。 then you can build a Drwable from Bitmap-
然后您可以从Bitmap构建Drwable-
Drawable d =new BitmapDrawable(bitmap);
And then for setting background in EditText 然后在EditText中设置背景
editText.setBackgroundDrawable(d);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.