title: fetching data from mysql db and display on android
body: <p>I have to develop one android example.</p>
  
  <p>Its performs the fetching data from mysql database and display on android application.</p>
  
  <p>I have used below webservice code:</p>
  
  <pre><code>public class EditProfile {
  public String customerData(String Username,String Password,String Firstname,String Lastname,String Company,String Taxnumber,String Baddress,String Bcity,String Bstate,String Bcountry,String Bzipcode,String Saddress,String Scity,String Sstate,String Scountry,String Szipcode,String Email,String Phone,String Fax,String Url){
  
   String customerInfo = "";
  
  try{
  
  Class.forName("com.mysql.jdbc.Driver");
  Connection con = DriverManager.getConnection("jdbc:mysql://10.0.0.75:3306/xcart432pro","root","");
   PreparedStatement statement =  con.prepareStatement("SELECT * FROM xcart_customers where login = '"+Username+"'");
   ResultSet result = statement.executeQuery();
  
  while(result.next()){
              customerInfo = customerInfo + result.getString("login") + ":" +result.getString("password")+ ":" +result.getString("firstname")
      }
  
       }
       catch(Exception exc){
           System.out.println(exc.getMessage());
             }
          return customerInfo;
          }
  </code></pre>
  
  <p>I have used below android code:</p>
  
  <pre><code> public class RetailerActivity extends Activity {
      private final String NAMESPACE = "http://xcart.com";
    private final String URL = "http://10.0.0.75:8085/XcartLogin/services/EditProfile?wsdl";
    private int i;
    private final String SOAP_ACTION = "http://xcart.com/customerData";
    private final String METHOD_NAME = "customerData";
  
    String str,mTitle;
    /** Called when the activity is first created. */
    @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
           try {
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
       SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  
       envelope.setOutputSoapObject(request);
  
       HttpTransportSE ht = new HttpTransportSE(URL);
  
         ht.call(SOAP_ACTION, envelope);
  
           SoapPrimitive s = response;
          str = s.toString();
         String[] words = str.split(":");
         TextView tv = (TextView) findViewById(R.id.user);
          tv.setText(Username);
  
        EditText tv1 = (EditText) findViewById(R.id.pass);
  
  
          tv1.setText(words[1].toString());
        EditText tv2 = (EditText) findViewById(R.id.tf_userName);
  
  
           tv2.setText(words[2].toString());
  
            for (int i = 0, l = words.length; i &lt; l; ++i) {
                  }}
  
         catch (Exception e) {
            e.printStackTrace();
             }
              }}
  </code></pre>
  
  <p>Here i have to run the app means fetching data from mysql database and display the data on android .but i didn't get the response.how can i get it.</p>
  
  <p>Here i have to wrote the condition like static:</p>
  
  <pre><code>SELECT * FROM xcart_customers where login = 'mercy'"); means fetching the data from mysql database and display the data for that user.its successfully worked.
  </code></pre>
  
  <p>But i have write the code dynamically means </p>
  
  <pre><code>"SELECT * FROM xcart_customers where login = '"+Username+"'"); means
  </code></pre>
  
  <p>didn't get the response.please help me.</p>
  
  <p>How can i develop these.give me solution or ideas for these.</p>