title: Many to many relation
body: <p>I have two classes on Parse.com : Image &amp; Data. In Data class, I am saving 3 fields Name,Mobile-number &amp; Occupation. In Image class I'm saving images.</p>
  
  <p>I have to create relation between these two classes so that I can fetch images with the corresponding mobile-number. one mobile number can save many images and the table Data can have many mobile numbers.</p>
  
  <p>Not able to find how can I fetch the images with a particular mobile number. Please help as I have gone thru the documentation. Thanks in advance. Here is my code:</p>
  
  <pre><code>public class GetImage extends Activity {
  // Declare Variables
  GridView gridview;
  List&lt;ParseObject&gt; ob;
  ProgressDialog mProgressDialog;
  GridViewAdapter adapter;
  Button imgbtn;
  EditText mbltxt;
  String mobileNumber;
  private List&lt;PhoneList&gt; phonearraylist = null;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Get the view from gridview_main.xml
      setContentView(R.layout.listview_main);
      // Execute RemoteDataTask AsyncTask
      imgbtn=(Button) findViewById(R.id.imgbtn);
      mbltxt = (EditText) findViewById(R.id.mbltxt);
  
      imgbtn.setOnClickListener(new View.OnClickListener(){
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
  
                  if (mbltxt.getText().toString().equals("")) {
                      Toast.makeText(getBaseContext(), "Please enter a valid mobilenumber", Toast.LENGTH_LONG).show();    
                  }else {
               new RemoteDataTask().execute();
          } 
          }
      });       
  }
  </code></pre>
  
  <p>After asking for mobile number, click on getImage button to query all the images for that mobile number.</p>
  
  <pre><code>// RemoteDataTask AsyncTask
  private class RemoteDataTask extends AsyncTask&lt;Void, Void, Void&gt; {
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          // Create a progressdialog
          mProgressDialog = new ProgressDialog(GetImage.this);
          // Set progressdialog title
          mProgressDialog.setTitle("Images");
          // Set progressdialog message
          mProgressDialog.setMessage("Loading...");
          mProgressDialog.setIndeterminate(false);
          // Show progressdialog
          mProgressDialog.show();
      }
  
      @Override
      protected Void doInBackground(Void... params) {
          // Create the array
          phonearraylist = new ArrayList&lt;PhoneList&gt;();
          try {
              // Locate the class table named "Image" in Parse.com
              ParseRelation&lt;ParseObject&gt; relation = currentUser.getRelation("img");
              ParseQuery&lt;ParseObject&gt; query = new ParseQuery&lt;ParseObject&gt;("Image");
  
              ob = query.find();
              for (ParseObject imgob : ob) {
                  ParseFile image = (ParseFile) imgob.get("ImageFile");
                  PhoneList map = new PhoneList();
                  map.setPhone(image.getUrl());
                  phonearraylist.add(map);
              }
           }catch (ParseException e) {
              Log.e("Error", e.getMessage());
              e.printStackTrace();
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(Void result) {
          // Locate the gridview in gridview_main.xml
          gridview = (GridView) findViewById(R.id.gridview);
          // Pass the results into ListViewAdapter.java
          adapter = new GridViewAdapter(GetImage.this,
                  phonearraylist);
          // Binds the Adapter to the ListView
          gridview.setAdapter(adapter);
          // Close the progressdialog
          mProgressDialog.dismiss();
      }
  }}
  </code></pre>