Up vote 1 down vote favorite share g+ share fb share tw.
I've got the following Async task, which should just load up an image from a given URL. The images do exist and I have access to them private class FetchVehicleImage extends AsyncTask { private ProgressBar mSpinner; private ImageView mImage; private String imagesBaseUrl = "http://mywebsite.net/images/"; private URL url = null; @Override protected void onPreExecute() { mImage = (ImageView) findViewById(R.id. Vehicle_image); mSpinner = (ProgressBar) findViewById(R.id.
Vehicle_image_progress_bar); mSpinner. SetIndeterminate(true); mSpinner. SetVisibility(View.
VISIBLE); mImage. SetVisibility(View. GONE); } @Override protected Bitmap doInBackground(String... strings) { Bitmap bm = null; try { url = new URL(imagesBaseUrl + strings0); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.
SetDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bm = BitmapFactory. DecodeStream(is); } catch (Exception e) { e.printStackTrace(); } return bm; } protected void onPostExecute(final Bitmap result) { if (result! = null) { mImage.
SetImageBitmap(result); } mImage. SetVisibility(View. VISIBLE); mSpinner.
SetVisibility(View. GONE); } } I never see an exception in the doInBackground, however sometimes bm is returned as null, but its very intermittent. I have 4 images, 3 of those load perfectly fine every time, but one only loads if I hit a breakpoint on the bm assignment, supposedly giving it enough time to do its work?
I thought that doInBackground should run on a background thread therefore I should always either get the image, or get an exception? Android multithreading android-asynctask android-2.1 link|improve this question asked Jan 21 at 11:25James. Elsey2,47531148 98% accept rate.
Perhaps this article might shed some light foo.jasonhudgins.com/2010/05/limitations... but in your case of only 4 images it's hardly applicable I would go with a usual Thread (override run()) and runOnUiTread in this case perhaps – Sergey Benner Jan 21 at 11:56.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.