I have URL String
but don't know how to set text in TextView
?.
ImageView fff1=(ImageView) findViewById(R.id.iop1);
TextView hol=(TextView)findViewById(R.id.mytext);
ImageLoadTask uu=new ImageLoadTask("https://maheshwaghela.com/VIPINIH/img/Mahesh/western/mimg10.jpg",fff1);
String gg=uu.url.toString();
hol.setText(gg);
I want the URL string
to be set in TextView
.
Here it is ImageLoadTask Class:
public class ImageLoadTask extends AsyncTask<Void, Void, Bitmap> {
private String url;
private ImageView imageView;
public ImageLoadTask(String url, ImageView imageView) {
this.url = url;
this.imageView = imageView;
}
@Override
protected Bitmap doInBackground(Void... params) {
try {
URL urlConnection = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlConnection
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap result) {
super.onPostExecute(result);
imageView.setImageBitmap(result);
}
}
My task is to get images from server and set to ImageView. It's fine there are no problems but then after I want to set Imageview URL in Textview where I am not able to get URL string into Textview.