Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to show values in separate text views in android
    text
    copied!<p>I am consuming a web service by soap method from Android. And I am showing the values from that web service in to two separate text views on the next screen.</p> <p>Here that web service is returning two values. But I'm only able to show one value from that web service in text view on the next screen.</p> <p>But I need to show both values in two separate textview boxes on the next screen.... How can I do this? </p> <p>Suggestions please..</p> <p><strong>NOTE :-</strong> <em>The input value for that web service is for <strong>FromDate :</strong> 01/01/2012 and for <strong>ToDate :</strong> 07/07/2012</em></p> <p><em>Please find my sources for reference</em></p> <p><strong>Main_WB.java</strong></p> <pre><code>public class Main_WB extends Activity { EditText edt1,edt2; //TextView txt_1; Button btn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); edt1 = (EditText)findViewById(R.id.editText1); edt2 = (EditText)findViewById(R.id.editText2); btn = (Button)findViewById(R.id.button1); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { getTMSChart(edt1.getText().toString(),edt2.getText().toString()); Intent myint = new Intent(Main_WB.this,ResultActivity.class); startActivity(myint); } }); } private void getTMSChart(String FromDate,String ToDate) { // txt_1 = (TextView)findViewById(R.id.textView1); System.setProperty("http.keepAlive", "false"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; String NAMESPACE = "http://tempuri.org/"; String URL = "http://54.251.60.177/TMSOrdersService/TMSDetails.asmx"; String METHOD = "GetTMSChart"; SoapObject request = new SoapObject(NAMESPACE, METHOD); request.addProperty("FromDate", FromDate); request.addProperty("ToDate", ToDate); envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(NAMESPACE + METHOD, envelope); SoapObject result = (SoapObject) envelope.bodyIn; SoapObject root = (SoapObject) ((SoapObject)(result).getProperty(0)).getProperty("NewDataSet"); int tablesCount = root.getPropertyCount(); for (int i = 0; i &lt; tablesCount; i++) { SoapObject table = (SoapObject) root.getProperty(i); int propertyCount = table.getPropertyCount(); // String[] ord = new String[propertyCount]; // String[] fre = new String[propertyCount]; // int[] fre = new int[propertyCount]; // int[] margin = new int[propertyCount]; for (int j = 0; j &lt; propertyCount; j++) { String x,y; // int orderNo = Integer.parseInt(table.getPropertyAsString("Order_No")); // int freightRate = Integer.parseInt(table.getPropertyAsString("Freight_Rate")); // int marginPercent = Integer.parseInt(table.getPropertyAsString("Margin_Percent")); String orderNo = table.getPropertyAsString("Order_No"); String freight = table.getAttributeAsString("Freight_Rate"); x = orderNo.toString(); y = freight.toString(); Intent in = new Intent(getApplicationContext(),ResultActivity.class); in.putExtra("gotonextpageX",x); in.putExtra("gotonextpageY", y); startActivity(in); //ord[j] = orderNo; // fre[j] = freightRate; // margin[j]= marginPercent; // x = orderNo.toString(); // y = fre.toString(); // Intent myIntent = new Intent(Main_WB.this, ResultActivity.class); // myIntent.putExtra("gotonextpage", x); // startActivity(myIntent); // whatever you do with these values } } } catch (Exception e) { } } } </code></pre> <p><strong>ResultActivity.java</strong></p> <pre><code>public class ResultActivity extends Activity { String x,y; TextView txt1,txt2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main1); Bundle extras = getIntent().getExtras(); if(extras != null) { x = extras.getString("gotonextpageX"); y = extras.getString("gotonextpageY"); } else { } txt1 = (TextView)findViewById(R.id.txtVw); txt2 = (TextView)findViewById(R.id.txtVw2); txt1.setText(x); txt2.setText(y); }} </code></pre> <p>Thanks for your precious time!..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload