I am downloading an image from URL and displaying on an imageview but the problem is if image name starts with a digit it can't be displayed.
private class DownloadFilesTask extends AsyncTask<String, Void, Bitmap> {
protected Bitmap doInBackground(String... urls) {
try {
URL url = new URL(urls[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(Bitmap result) {
//loading.dismiss();
String image_name = result.toString();
if( Character.isDigit(image_name.charAt(0))){
}
imageView.setImageBitmap(result);
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
}