Android AsynkTask Throwing null pointer
<p>Not exactly sure what I'm doing wrong here but I'm trying to download an image from an https url using a AsynkTask but I'm epicly failing somehow?! Why am I getting a null pointer exception?</p>

<p>I've trapped the url and displayed it so I know it's legit, I even hit it with the web browser. </p>

<pre><code>public class WelcomeFragment extends Fragment {
    SimpleCursorAdapter adapter;
    static final String[] FROM = { StatusData.KEY_USER_NAME };
    static final int[] TO = { R.id.txtName };
    private ProgressDialog simpleWaitDialog;
    private ImageView downloadedImg;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }       

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        WebView mWebView;
        TextView mName, memail, mother, mtextView1;
        ImageView mpicture;

        View view = inflater.inflate(R.layout.fragment_welcome, null);

        String about = getResources().getString(R.string.about_msg);
        mName = (TextView) view.findViewById(R.id.txtName);
        memail = (TextView) view.findViewById(R.id.txtEmail);
        mpicture = (ImageView) view.findViewById(R.id.profilepicture);
        mother = (TextView) view.findViewById(R.id.txtOther);
        mtextView1 = (TextView) view.findViewById(R.id.textView1);


        about = about.replace("\\", "");
        about = "&lt;html&gt;&lt;body&gt;"
                + "&lt;p align=\"justify\"&gt;" 
                + about + "&lt;/p&gt; "
                + "&lt;/body&gt;&lt;/html&gt;";

        // Get the data
        Cursor c = getActivity().getContentResolver().query(StatusProvider.CONTENT_URI_USER, null, null, null, null);

        if(c.moveToFirst())
        {

            mName.setText(c.getString(2));
            memail.setText(c.getString(5)); //email
            mtextView1.setText(c.getString(6)); //picture url

            mpicture.setTag(c.getString(6));


            new ImageDownloader().execute(c.getString(6));



            mother.setText(c.getString(7)); //significant_other
            Log.i("WELCOME", "NAME FOUND IN TABLE" );
        } else {
            Log.i("WELCOME", "NAME NOT FOUND IN TABLE" );
        }


        mWebView = ((WebView) view.findViewById(R.id.about));

        mWebView.loadData(about, "text/html", "utf-8");

        return view;
    }   


    private class ImageDownloader extends AsyncTask&lt;String, Void, Bitmap&gt; {

        @Override
        protected Bitmap doInBackground(String... param) {
            // TODO Auto-generated method stub
            return downloadBitmap(param[0]);
        }

        @Override
        protected void onPreExecute() {
            Log.i("Async-Example", "onPreExecute Called");
            simpleWaitDialog = ProgressDialog.show(getActivity(),"Wait", "Downloading Image");

        }

        @Override
        protected void onPostExecute(Bitmap result) {
            Log.i("Async-Example", "onPostExecute Called");
            downloadedImg.setImageBitmap(result);
            simpleWaitDialog.dismiss();
        }

        private Bitmap downloadBitmap(String url) {
            // initilize the default HTTP client object
            final DefaultHttpClient client = new DefaultHttpClient();

            //forming a HttoGet request 
            final HttpGet getRequest = new HttpGet(url);
            try {

                HttpResponse response = client.execute(getRequest);

                //check 200 OK for success
                final int statusCode = response.getStatusLine().getStatusCode();

                if (statusCode != HttpStatus.SC_OK) {
                    Log.w("ImageDownloader", "Error " + statusCode + " while retrieving bitmap from " + url);
                    return null;

                }

                final HttpEntity entity = response.getEntity();
                if (entity != null) {
                    InputStream inputStream = null;
                    try {
                        // getting contents from the stream 
                        inputStream = entity.getContent();

                        // decoding stream data back into image Bitmap that android understands
                        final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);

                        return bitmap;
                    } finally {
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        entity.consumeContent();
                    }
                }
            } catch (Exception e) {
                // You Could provide a more explicit error message for IOException
                getRequest.abort();
                Log.e("ImageDownloader", "Something went wrong while retrieving bitmap from " + url + e.toString());
            } 

            return null;
        }
    }

}
</code></pre>

<p>logcat:</p>

<pre><code>    05-23 13:32:00.116: E/AndroidRuntime(22911): FATAL EXCEPTION: main
    05-23 13:32:00.116: E/AndroidRuntime(22911): java.lang.NullPointerException
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at com.projectcaruso.naturalfamilyplaning.WelcomeFragment$ImageDownloader.onPostExecute(WelcomeFragment.java:111)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at com.projectcaruso.naturalfamilyplaning.WelcomeFragment$ImageDownloader.onPostExecute(WelcomeFragment.java:1)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.os.AsyncTask.finish(AsyncTask.java:631)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.os.Handler.dispatchMessage(Handler.java:99)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.os.Looper.loop(Looper.java:137)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at android.app.ActivityThread.main(ActivityThread.java:4950)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at java.lang.reflect.Method.invokeNative(Native Method)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at java.lang.reflect.Method.invoke(Method.java:511)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
    05-23 13:32:00.116: E/AndroidRuntime(22911):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>
