Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to call a web service that returns an arrayList in android?
    primarykey
    data
    text
    <p>I want to retrieve an arrayList from the web service in my android activity. The following code doesn't work:<br> How to solve tha error? When I tried this way, res is null! </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); System.out.println("qqqqqqqqqqq"); setContentView(R.layout.second); Button submit = (Button) findViewById(R.id.b01); submit.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_SHORT).show(); EditText txt = (EditText) findViewById(R.id.editText1); String text = txt.toString(); SoapObject request = new SoapObject(Name_Space, Method_Name); PropertyInfo pi1 = new PropertyInfo(); pi1.setName("shopId"); pi1.setValue(text); request.addProperty(pi1); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { System.out.println("Hellooooooooooo66666666666666"); androidHttpTransport.call(Soap_Action, envelope); SoapPrimitive res = (SoapPrimitive) envelope.getResponse(); System.out.println("Result SP " + res); ArrayList&lt;Discount&gt; result = (ArrayList&lt;Discount&gt;) envelope.getResponse(); Toast.makeText(getApplicationContext(), "Hi", Toast.LENGTH_SHORT).show(); System.out.println("Result in getResult() : " + res); System.out.println("Traversing ArrayList in forward direction "); if (res != null) { for (Discount ds : result) { discount = ds; } } else { Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show(); } Toast.makeText(getApplicationContext(), envelope.getResponse().toString(), Toast.LENGTH_SHORT) .show(); Toast.makeText(getApplicationContext(), discount.getProductName(), Toast.LENGTH_SHORT).show(); System.out.println("Size 1111 " + result.size()); } catch (NullPointerException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } } </code></pre> <p>Thanks,<br> Sneha</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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