AsyncTask as Inner class and static field issue
===

I have a method `searchPlace()` that updates a static Arrays of custom Place Object in a class A (FindItOnMap) with a google map, and a method `updateMap()` that updates the various geopoints .
I invoke these methods on click button and all works properly.
Since these methods use iternet data this operation could take a while, I have looking for the implementation of an inner class B(YourCustomAsyncTask) inside the class A that extends AsyncTask to show a waiting dialog during the processing of these two methods


An user suggested a solution in this form (that apparently seems valid)

    public class FindItOnMap extends MapActivity { 
     
    static Place[] foundResults; 
    private ProgressDialog dialog; 
     
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         setContentView(R.layout.ricerca_condominio); 
         mapView = (MapView)findViewById(R.id.mapView); 
                 ........... 
     
         ((ImageButton) findViewById(R.id.btSearch)).setOnClickListener(mSearchListenerListener); 
     
     
         } 
     
        OnClickListener mSearchListener = new OnClickListener() { 
            public void onClick(View v) { 
                    String Location=editorLocation.getText().toString(); 
                    String name=editorName.getText().toString(); 
                 //Call the AsyncTask here 
                new YourCustomAsyncTask().execute(new String[] {name, location}); 
     
            } 
     
     
        private class YourCustomAsyncTask extends AsyncTask <String, Void, Void> {  
     
            @Override  
            protected void onPreExecute() {  
               dialog = new ProgressDialog(Main.this);  
               dialog.setMessage("Loading....");  
               dialog.setIndeterminate(true);  
               dialog.setCancelable(true);  
               dialog.show(); //Maybe you should call it in ruinOnUIThread in doInBackGround as suggested from a previous answer 
            }  
     
            @Override  
            protected Void doInBackground(String... strings) {  
               try {  
     
                  search(strings[0], string[1]);  
     
               } catch(Exception e) { 
               } 
     
            } 
     
        @Override  
        protected void onPostExecute(Void params) {  
            updateMapWithResult();  
            dialog.dismiss();  
            //result  
     
        }  
     
     
    ..... 
    } 

The waiting dialog is showed and the methods are invoked in background,
However for some strange reason the static list `foundResults` results filled with various `null` items... 

How  this is possible?

If I invoke the methods search(location, name) outside the inner class all works properly and 
updateMapWithResult(); updates all geopoint, so these two methods are ok

only if I try to invoke this in the inner class the json calls seems working but the static variable foundResults is filled with null elements and the program doesn't work properly.

Any suggestion?