0

我有四个单选按钮,我想为每个按钮设置一个文本,我从服务器获取数据并将该数据设置为这些按钮,如下所示:

protected String[] doInBackground(String... params) {
HttpClient client = new DefaultHttpClient();
                website = new URI(
                        "http://10.0.2.2:8080/LocalizedBasedComptitionServer/SendQuestion");
                HttpPost request = new HttpPost();
                request.setURI(website);
                HttpResponse response = client.execute(request);
                HttpEntity entity = response.getEntity();
                results[0] = response.getFirstHeader("Info").toString();
                results[1] = response.getFirstHeader("Question").toString();
                results[2] = response.getFirstHeader("Choice1").toString();
                results[3] = response.getFirstHeader("Choice2").toString();
                results[4] = response.getFirstHeader("Choice3").toString();
                results[5] = response.getFirstHeader("Choice4").toString();
                results[6] = response.getFirstHeader("Hint1").toString();

    results[7] = response.getFirstHeader("Hint2").toString();
}
protected void onPostExecute(String[] results) {
            super.onPostExecute(results);
            question.setText(results[1]);
            choice1.setText(results[2]);
            choice2.setText(results[3]);
            choice3.setText(results[4]);
            choice4.setText(results[5]);
            firstHint.setText(results[6]);
            secondHint.setText(results[7]);
            // rightChoice = Integer.parseInt(results[8]);
        }

但我的问题是,如果我发送 roma , milan, italy , love 给客户,打印到单选按钮的数据是choice1:romachoice2:milan,choice3:italy,choice4:love 我不想打印那个choice1,choice2 ,choice3,choice4 我做错了什么,谢谢

4

1 回答 1

2

尝试response.getFirstHeader("xxx").getValue()

于 2012-06-23T12:53:40.117 回答