title: android listview using soap calling
body: <p>Hi i have to develop one listview app in android using soap calling.here i wish to run the app means the orderid and status is displayed here.here i have to click any order from list means the status is displayed next activity.</p>
  
  <p>But the orderid and status is displayed on listview successfully..but here faced some problem...the orderid and status is displayed following format:</p>
  
  <pre><code>1
  ---------
  F2
  ----------
  Q3
  ----------
  P
  -----------
  </code></pre>
  
  <p>But i wish to display below format:</p>
  
  <pre><code>1 F
  ---------
  2 Q
  ---------
  3 P
  ---------
  </code></pre>
  
  <p>This is my <strong>android code</strong>:</p>
  
  <pre><code>public class RetailerActivity extends Activity {
  ListView list;
  private static final String SOAP_ACTION = "http://xcart.com/customerData1";
  private static final String METHOD_NAME = "customerData1";
  private static final String NAMESPACE = "http://xcart.com";
  private static final String URL = "http://192.168.1.168:8089/XcartLogin/services/RetailerWs?wsdl";
  private static final String KEY_STATUS = "status";
  
  
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
  
      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  
      envelope.setOutputSoapObject(request);
  
      HttpTransportSE ht = new HttpTransportSE(URL);
      try {
          ht.call(SOAP_ACTION, envelope);
          SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
          SoapPrimitive s = response;
          String str = s.toString();
          String resultArr[] = str.split("&amp;");
          list=(ListView)findViewById(R.id.list);
  
  
          list.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1,resultArr));
          list.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
  
                  String s2= getIntent().getStringExtra("status");
  
  
                  // Starting new intent
                  Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
  
                   in.putExtra(KEY_STATUS, s2);
  
  
                   startActivity(in);                 
  
              }
          });     
      }
  
  
      catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  }
  </code></pre>
  
  <p>This is my <strong>webservice code</strong>:</p>
  
  <pre><code>public class RetailerWs {
  public String customerData1(){
  String customerInfo = "";
  try{
  Class.forName("com.mysql.jdbc.Driver");
  Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/xcart-432pro","root","");
    //Find customer information where the customer ID is maximum
  PreparedStatement statement =  con.prepareStatement("SELECT * FROM xcart_orders");
  ResultSet result = statement.executeQuery();
  
   while(result.next()){
  customerInfo = customerInfo + result.getString("orderid") + "&amp;" + result.getString("status");
    //Here "&amp;"s are added to the return string. This is help to split the string in Android application
   }
   }
  
   catch(Exception exc){
   System.out.println(exc.getMessage());
   }
  
  return customerInfo;
   }
  
   }
  </code></pre>
  
  <p>this is my main.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"&gt;
  
   &lt;ListView
      android:id="@+id/list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:divider="#b5b5b5"
      android:dividerHeight="1dp"
      android:listSelector="@drawable/list_selector" /&gt;
  
   &lt;/LinearLayout&gt;
  </code></pre>