title: Nullpointer exception - unexpected error in fragment
body: <p>I have received an unexpected nullpoint exception error while try to load the application. I am not sure what went wrong, and have spent a while trying to resolve the issue.
  I have included below the logcat message:</p>
  
  <pre><code>09-01 22:26:44.311: E/AndroidRuntime(5805):     at com.dooba.beta.Fragment1$3.done(Fragment1.java:280)
  09-01 22:44:46.383: E/AndroidRuntime(6035): java.lang.NullPointerException
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.dooba.beta.Fragment1$3.done(Fragment1.java:281)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.parse.FindCallback.internalDone(FindCallback.java:45)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.parse.FindCallback.internalDone(FindCallback.java:31)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.parse.Parse$5$1.run(Parse.java:891)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at android.os.Handler.handleCallback(Handler.java:733)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at android.os.Handler.dispatchMessage(Handler.java:95)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at android.os.Looper.loop(Looper.java:136)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at java.lang.reflect.Method.invoke(Method.java:515)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  09-01 22:44:46.383: E/AndroidRuntime(6035):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>below is the activity code</p>
  
  <pre><code>public class Fragment1 extends Fragment {
  
      public interface Constants {
          String LOG = "com.dooba.beta";
      }
  
      private String currentUserId;
      private ArrayAdapter&lt;String&gt; namesArrayAdapter;
      private ArrayList&lt;String&gt; names;
      private ArrayList&lt;String&gt; age;
      private ArrayList&lt;String&gt; headline;
      private ArrayList&lt;String&gt; activityname;
  
      protected TextView mUserRetrieved;
      protected TextView mUserActivityNameRetrieved;
      protected TextView mUserNameRetrieved;
      protected TextView mUserAgeRetrieved;
      protected TextView mUserHeadlineRetrieved;
  
  
  
      private ArrayList&lt;Images&gt; alProfilePicture;
      private ListView usersListView;
      private Button logoutButton;
      String userGender = ParseUser.getCurrentUser().getString("Gender");
      String activityName = ParseUser.getCurrentUser().getString("ActivityName");
      Number maxDistance = ParseUser.getCurrentUser().getNumber(
              "Maximum_Distance");
      String userLookingGender = ParseUser.getCurrentUser().getString(
              "Looking_Gender");
      Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age");
      Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age");
      Number userage = ParseUser.getCurrentUser().getNumber("UserAge");
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
  
          setConversationsList();
  
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment1_layout, container,
                  false);
  
          //mUserRetrieved = (TextView) getActivity().findViewById(R.id.userlistname);
  
  
          Button newPage = (Button)view.findViewById(R.id.btnMatchConfirm);
          newPage.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
              //    ParseUser currentUser = ParseUser.getCurrentUser();
  
            //      currentUser.put("UserMatchName", mUserRetrieved);
                  Intent intent = new Intent(getActivity(), matchOptionActivity.class);
                  startActivity(intent);
              }
          });
  
  
  
          return view;
      }
  
      private void setConversationsList() {
          currentUserId = ParseUser.getCurrentUser().getObjectId();
          names = new ArrayList&lt;String&gt;();
          age = new ArrayList&lt;String&gt;();
          headline = new ArrayList&lt;String&gt;();
          activityname = new ArrayList&lt;String&gt;();
  
          alProfilePicture = new ArrayList&lt;Images&gt;();
  
          // String userActivitySelectionName = null;
  
          ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery();
  
          // query.whereEqualTo("ActivityName",userActivitySelectionName);
  
          query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query.whereEqualTo("Looking_Gender", userGender);
          query.setLimit(1);
          query.whereEqualTo("ActivityName", activityName);
          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
          query.whereLessThanOrEqualTo("UserAge", maximumAge);
          query.orderByDescending("Name");
  
  
          ParseQuery&lt;ParseUser&gt; query1 = ParseUser.getQuery();
  
          // query.whereEqualTo("ActivityName",userActivitySelectionName);
  
          query1.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query1.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query1.whereEqualTo("Looking_Gender", userGender);
          query1.setLimit(1);
          query1.whereEqualTo("ActivityName", activityName);
          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
          query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
          ParseQuery&lt;ParseUser&gt; query11 = ParseUser.getQuery();
  
          //query.whereEqualTo("ActivityName",userActivitySelectionName);
  
          query11.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query11.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query11.whereEqualTo("Looking_Gender", userGender);
          query11.setLimit(1);
          query11.whereEqualTo("ActivityName", activityName);
          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
          query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
          ParseQuery&lt;ParseUser&gt; query4 = ParseUser.getQuery();
  
          // query.whereEqualTo("ActivityName",userActivitySelectionName);
  
          query4.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query4.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query4.whereEqualTo("Looking_Gender", userGender);
          query4.setLimit(1);
          query4.whereEqualTo("ActivityName", activityName);
          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
          query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
          ParseQuery&lt;ParseUser&gt; query5 = ParseUser.getQuery();
  
          // query.whereEqualTo("ActivityName",userActivitySelectionName);
  
          query5.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query5.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query5.whereEqualTo("Looking_Gender", userGender);
          query5.setLimit(1);
          query5.whereEqualTo("ActivityName", activityName);
         query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
         query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
  
        //  whereWithinKilometers("Maximum_distance", point, double maxDistance);
  
  
  
  
          Log.d(Constants.LOG, "");
  
  
  
  
          query.findInBackground(new FindCallback&lt;ParseUser&gt;() {
  
              @Override
              public void done(List&lt;ParseUser&gt; objects,ParseException e) {
  
                  for(int i=0;i&lt;objects.size();i++){
                      // Do whatever you need to extract object from "users"
                      ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User");
                      query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                              .getObjectId());
                      // users with Gender = currentUser.Looking_Gender
                      query.whereEqualTo("Gender", userLookingGender);
                      // users with Looking_Gender = currentUser.Gender
                      query.whereEqualTo("Looking_Gender", userGender);
                      query.setLimit(1);
                      query.whereEqualTo("ActivityName", activityName);
                      query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                      query.whereLessThanOrEqualTo("UserAge", maximumAge);
                      query.orderByDescending("Name");
  
                      ParseFile image = objects.get(i).getParseFile("ProfilePicture");
  
  
                      ParseImageView imageView = (ParseImageView) getView().findViewById(R.id.profilePictureresult);
  
                       // The placeholder will be used before and during the fetch, to be replaced by the fetched image
                       // data.
                       imageView.setPlaceholder(getResources().getDrawable(R.drawable.profile_pict));
                       imageView.setParseFile(image);
                       imageView.loadInBackground(new GetDataCallback() {
                         @Override
                         public void done(byte[] data, ParseException e) {
                             if (data != null) {
                                 Log.i("ParseImageView", "Fetched: " + data.length);
                               } else {
                                 Log.e("ParseImageView", "Error fetching: " + e.getMessage());
                               }
                         }
  
  
                   });
                  }
      }//for loop
              });
  
  
          query1.findInBackground(new FindCallback&lt;ParseUser&gt;() {
              @Override
              public void done(List&lt;ParseUser&gt; objects,ParseException e) {
  
                  for(int i=0;i&lt;objects.size();i++){
                      // Do whatever you need to extract object from "users"
                      ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User");
                      query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                              .getObjectId());
                      // users with Gender = currentUser.Looking_Gender
                      query.whereEqualTo("Gender", userLookingGender);
                      // users with Looking_Gender = currentUser.Gender
                      query.whereEqualTo("Looking_Gender", userGender);
                      query.setLimit(1);
                      query.whereEqualTo("ActivityName", activityName);
                      query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                      query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
                      mUserNameRetrieved = (TextView) getActivity().findViewById(R.id.userlistname);
  
                      mUserNameRetrieved.setText(objects.get(i).get("Name").toString()); 
  
  
  
                  }
      }//for loop
              });
  
          query11.findInBackground(new FindCallback&lt;ParseUser&gt;() {
              @Override
              public void done(List&lt;ParseUser&gt; objects,ParseException e) {
  
                  for(int i=0;i&lt;objects.size();i++){
                      // Do whatever you need to extract object from "users"
                      ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User");
                      query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                              .getObjectId());
                      // users with Gender = currentUser.Looking_Gender
                      query.whereEqualTo("Gender", userLookingGender);
                      // users with Looking_Gender = currentUser.Gender
                      query.whereEqualTo("Looking_Gender", userGender);
                      query.setLimit(1);
                      query.whereEqualTo("ActivityName", activityName);
                      query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                      query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
                      mUserHeadlineRetrieved = (TextView) getActivity().findViewById(R.id.userlistheadline);
  
                      mUserHeadlineRetrieved.setText(objects.get(i).get("Headline").toString()); 
  
  
  
                  }
      }//for loop
              });
  
  
  
  
              query4.findInBackground(new FindCallback&lt;ParseUser&gt;() {
  
                  @Override
                  public void done(List&lt;ParseUser&gt; objects,ParseException e) {
  
                      for(int i=0;i&lt;objects.size();i++){
                          // Do whatever you need to extract object from "users"
                          ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User");
                          query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                                  .getObjectId());
                          // users with Gender = currentUser.Looking_Gender
                          query.whereEqualTo("Gender", userLookingGender);
                          // users with Looking_Gender = currentUser.Gender
                          query.whereEqualTo("Looking_Gender", userGender);
                          query.setLimit(1);
                          query.whereEqualTo("ActivityName", activityName);
                          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                          query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
                          mUserActivityNameRetrieved = (TextView) getActivity().findViewById(R.id.userlistactivityname);
  
                          mUserActivityNameRetrieved.setText(objects.get(i).get("ActivityName").toString()); 
  
  
  
                      }
          }//for loop
                  });
  
              query5.findInBackground(new FindCallback&lt;ParseUser&gt;() {
  
                  @Override
                  public void done(List&lt;ParseUser&gt; objects,ParseException e) {
  
                      for(int i=0;i&lt;objects.size();i++){
                          // Do whatever you need to extract object from "users"
                          ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User");
                          query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                                  .getObjectId());
                          // users with Gender = currentUser.Looking_Gender
                          query.whereEqualTo("Gender", userLookingGender);
                          // users with Looking_Gender = currentUser.Gender
                          query.whereEqualTo("Looking_Gender", userGender);
                          query.setLimit(1);
                          query.whereEqualTo("ActivityName", activityName);
                          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
                          query.whereLessThanOrEqualTo("UserAge", maximumAge);
  
                          mUserAgeRetrieved = (TextView) getActivity().findViewById(R.id.userlistage);
  
                          mUserAgeRetrieved.setText(objects.get(i).get("Age").toString()); 
  
  
  
                      }
          }//for loop
                  });
  
  
      }
  
      public void openConversation(ArrayList&lt;String&gt; names, int pos) {
          ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery();
          query.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
                  .getObjectId());
          // users with Gender = currentUser.Looking_Gender
          query.whereEqualTo("Gender", userLookingGender);
          // users with Looking_Gender = currentUser.Gender
          query.whereEqualTo("Looking_Gender", userGender);
          query.setLimit(1);
          query.whereEqualTo("ActivityName", activityName);
          query.whereGreaterThanOrEqualTo("UserAge", minimumAge);
          query.whereLessThanOrEqualTo("UserAge", maximumAge);
          query.findInBackground(new FindCallback&lt;ParseUser&gt;() {
              public void done(List&lt;ParseUser&gt; user, ParseException e) {
                  if (e == null) {
                      Intent intent = new Intent(getActivity()
                              .getApplicationContext(), MessagingActivity.class);
                      intent.putExtra("Name", user.get(0).getObjectId());
                      startActivity(intent);
                  } else {
                      Toast.makeText(getActivity().getApplicationContext(),
                              "Error finding that user", Toast.LENGTH_SHORT)
                              .show();
                  }
              }
          });
      }
  
  
  }
  </code></pre>
  
  <p>Thanks in advance</p>