title: Unable to locate imageview for uploading to parse
body: <p><strong>Edit: Solved.</strong></p>
  
  <p>I'm trying to upload an image to parse that has been selected from the phone's gallery. However I cannot seem to locate the imageview as it returns null. I think this page: <a href="https://stackoverflow.com/questions/25295154/saving-images-to-parse">Saving images to Parse</a> has a similar question to what I'm asking but there is no answer to it.</p>
  
  <p>Fragment class:</p>
  
  <pre><code>public void onClick(View view) {
              img = (ImageView) rootView.findViewById(R.id.imageView1);
              // Locate the image (error is here)
              Bitmap bitmap = BitmapFactory.decodeResource(getActivity().getResources(), img);
              // Convert it to byte
              ByteArrayOutputStream stream = new ByteArrayOutputStream();
              // Compress image to lower quality scale 1 - 100
              bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
              byte[] image = stream.toByteArray();
  
  
              //byte[] image = img.getContext().toString().getBytes();
  
              //Bitmap bitmap = BitmapFactory.decodeFile(img);
  
              ParseFile file = new ParseFile("image.jpg", image);
              file.saveInBackground();
              ParseObject familyTree = new ParseObject("FamilyTree");
              familyTree.put("image", file);
              familyTree.put("name", etName.getText().toString());
              familyTree.put("relation", etRelation.getText().toString());
              familyTree.saveInBackground();
              Toast.makeText(FamilyTreeFragment2.this.getActivity(), "Saved.", Toast.LENGTH_SHORT).show();
              // getFragmentManager().beginTransaction().replace(R.id.container, new FamilyTreeFragment2()).addToBackStack(null).commit();
          }
  </code></pre>
  
  <p>Any help is appreciated. Thank you.</p>