Frage

i have four radio buttons , and i want to set a text for each one , i get data from a server and set that data to those buttons like this:

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]);
        }

but my problem is that if i send roma , milan, italy , love to client , the data printed to radio buttoms is choice1:roma choice2:milan, choice3:italy, choice4:love i don't want to print that choice1,choice2, choice3,choice4 what am i doing wrong , thank you

War es hilfreich?

Lösung

Try response.getFirstHeader("xxx").getValue()

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top