-2

ページと Web サービスを作成しました。ボタンクリック機能の値を取得するために割り当てます。しかし、クリックしてもアプリケーションが応答しません。

4

2 に答える 2

1

AsyncTaskクラスを使用して、ジンジャーブレッドの上で例外をスローし、大部分が推奨されないUIスレッドからWebサービスを呼び出している可能性があります。

class nwthread extends AsyncTask<Void,Void,Void>

{
@Override
    protected void onPreExecute() {
//progress dialog invoke ( notifies the user about whats going on better than making them stare on a blank screen)
        super.onPreExecute();
    }

    @Override
    protected Void doInBackground(Void... params) {
        //make request to webservice
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);
//dismiss progress dialog
        // update the UI here ... ie declare adapters / bind them, update other views

    }
}

上記はその一例です!これを onCreate() 内から次のように実行します

new nwthread.execute();
于 2013-08-01T05:05:21.310 に答える