how to access inner class variable in outer class method in java
<p>I want to access inner class Hashmap variable in outer class method means item selected listener of spinner. I have Hashmap declare inside inner class and I am assigning value in Hashmap inside inner class method. I am accessing the hashmap value using key in setOnItemSelectedListener from outer class but i got null value in hashmap.<br />
I was made hashmap static in outer class and put the value in inner class and again access from the outer class listener but again got null value. if anybody having another soltion so please tell me. I am little bit confused here .I don't know where i am wrong. Please anybody have solution.</p>

<p>following is the outer and inner class</p>

<pre><code>public class ProjectDetailActivity extends SherlockActivity {

// declare hashmap.
HashMap&lt;String, String&gt; phaseIdKv = new HashMap&lt;String, String&gt;();
@Override
protected void onCreate(Bundle savedInstanceState) {

    new LoadPhaseData().execute(projId);
    //create variable of inner class
    final ProjectDetailActivity.LoadPhaseData inner = new ProjectDetailActivity().new LoadPhaseData(); 

   //Listener for Phase spinner

    projSpinnerPhase.setOnItemSelectedListener((OnItemSelectedListener) new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                int arg2, long arg3) {

            int id = projSpinnerPhase.getSelectedItemPosition();
            ++id;
            String p_id= inner.phaseIdKv.get(id); //Here I want to access inner class hashmap value
            Log.v("hashmap value","-"+inner.phaseIdKv.get(id));//getting null

            Toast.makeText(getApplicationContext(),"item-"+id+" item2"+item+"p_id"+p_id, Toast.LENGTH_LONG).show();
        }

    });     
}
private class LoadPhaseData extends AsyncTask&lt;String, Void, Void&gt; {


    @Override
    protected Void doInBackground(String... params) {
        -----
        JSONArray phaseData = new JSONArray(jsonpPhaseList);
            String [] phaseNo = new String[jsonpPhaseList.length()];
            String phase;
            String phaseId1;
            if (phaseData.length() &gt;0) {
                for(int i =0;i&lt;phaseData.length();i++){
                    JSONObject joPhasefromJa = phaseData.getJSONObject(i);

                    phase = joPhasefromJa.getString("phase_no")
                    phaseId1 = joPhasefromJa.getString("phase_id");

                    phaseIdKv.put(phase,phaseId1);                  
                }
            }
        return null;
    }
</code></pre>
