title: How to pass a variable from onItemClick to some java class
body: <p>I need to get the variable "position" from the <code>OnClickListener</code>'s <code>onItemClick</code>.</p>
  
  <pre><code>gallery.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id)
          { //Actions based on user's click }
  </code></pre>
  
  <p>This "position" will be used in the another class.<br>
  I have tried the <code>SharedPreferences</code> way but it says that<br>
  <code>The method getDefaultSharedPreferences(Context) in the type PreferenceManager is not applicable for the arguments (new AdapterView.OnItemClickListener(){})</code> </p>
  
  <p>In need of some help.</p>