クラス A (FindItOnMap) のカスタム Place オブジェクトを Google マップで更新するメソッドsearchPlace()と、さまざまなジオポイントを更新するメソッドがあります。これらのメソッドを呼び出すと、すべて正常に動作します。static ArraysupdateMap()Button.onClick
これらのメソッドはインターネット データを使用するため、この操作には時間がかかる可能性があるため、これら 2 つのメソッドの処理中に待機中のダイアログを表示するためにYourCustomAsyncTask拡張されるクラス A 内の内部クラス B( ) の実装を探していました。AsyncTask
ユーザーは次の形式で解決策を提案しました (これは有効に思われます)。
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]);  
                return null;
            } catch(Exception e) { 
            } 
        } 
        @Override  
        protected void onPostExecute(Void params) {  
            updateMapWithResult();  
            dialog.dismiss();  
            //result  
        }  
..... 
    } 
待機中のダイアログが表示され、メソッドがバックグラウンドで呼び出されますが、何らかの奇妙な理由で、静的リストのfoundResults結果がさまざまな項目でいっぱいになりnullます...
これはどのように可能ですか?
内部クラスの外部でメソッド search(location, name) を呼び出すと、すべてが適切に機能し、updateMapWithResult();すべてのジオポイントが更新されるため、これら 2 つのメソッドは問題ありません。内部クラスでこれを呼び出そうとした場合にのみ、json 呼び出しは機能しているように見えますが、静的変数foundResultsが要素で満たされnull、プログラムが正しく機能しません。
なにか提案を?