title: Fetching image from parse
body: <p>Below is the code for getting imagefile from parse,
  but it throws <code>NullPointerException</code>.</p>
  
  <p>Please let me know what is wrong in this code.</p>
  
  <p>ImgFile-->is the class name in parse
  Img-->column name in ImgFile </p>
  
  <pre><code>    imgItem= (ImageView) findViewById(R.id.imageView);
      Log.d("after image creation", " null");
  
  
      ParseObject anotherApplication = new ParseObject("ImgFile");
      ParseFile applicantResume = (ParseFile)anotherApplication.get("Img");
      applicantResume.getDataInBackground(new GetDataCallback() {
       @Override
          public void done(byte[] data, com.parse.ParseException e) {
  
           if (e == null)
           {
               Log.d("before image", " null");
               Bitmap bmp = BitmapFactory.decodeByteArray(data, 0,
                       data.length);
  
               if (bmp != null)
               { imgItem.setImageBitmap(bmp);
                   // img.setPadding(10, 10, 0, 0);
               }
           }
           else
           {
               Log.e("paser after downloade", " null");
           }
          }
      });
  </code></pre>
  
  <p>LogCat error is : </p>
  
  <pre><code>            02-20 16:21:32.435    7666-        7666/com.dsstechnologies.janardanswami E/AndroidRuntime﹕ FATAL EXCEPTION: main
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dsstechnologies.janardanswami/com.dsstechnologies.janardanswami.Allimg}: java.lang.NullPointerException
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2268)
          at android.app.ActivityThread.access$600(ActivityThread.java:148)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:5162)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:525)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:756)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:572)
          at miui.dexspy.DexspyInstaller.main(DexspyInstaller.java:171)
          at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.NullPointerException
          at com.dsstechnologies.janardanswami.Allimg.onCreate(Allimg.java:43)
          at android.app.Activity.performCreate(Activity.java:5135)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
          at com.lbe.security.service.core.client.b.x.callActivityOnCreate(Unknown Source)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2182)
  </code></pre>
  
  <p><strong>Allimg.java</strong></p>
  
  <pre><code>        public class Allimg extends Activity {
          public ImageView imgItem;
         @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.allimg);
  
      // Parse.enableLocalDatastore(this);
          Parse.initialize(this, "",
              "");
  
         imgItem= (ImageView) findViewById(R.id.imageView);
         Log.d("after image creation", " null");
  
  
      ParseObject anotherApplication = new ParseObject("ImgFile");
      ParseFile applicantResume = (ParseFile)anotherApplication.get("Img");
      applicantResume.getDataInBackground(new GetDataCallback() {
       @Override
          public void done(byte[] data, com.parse.ParseException e) {
  
           if (e == null)
           {
               Log.d("before image", " null");
               Bitmap bmp = BitmapFactory.decodeByteArray(data, 0,
                       data.length);
  
               if (bmp != null)
               { imgItem.setImageBitmap(bmp);
                   // img.setPadding(10, 10, 0, 0);
               }
           }
           else
           {
               Log.e("paser after downloade", " null");
           }
          }
      });
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanking you..</p>