Note that there are some explanatory texts on larger screens.

plurals
  1. POerror with AsyncTask - android.os.NetworkOnMainThreadException
    primarykey
    data
    text
    <p>I am getting error : android.os.NetworkOnMainThreadException. My app is working fine on emulator. Then I check it on some devices, It is working fine with android version 2.3.5 but giving error with second device which has version 4.0.3. I am using AsyncTask as follows :</p> <pre><code>private class TheTask extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { dialog = ProgressDialog.show(Main.this, "", "Loading. Please wait...", true); } @Override protected String doInBackground(String... params) { request = new SoapObject(NAMESPACE, METHOD_NAME); userid = new PropertyInfo(); userid.setName("UserId"); userid.setValue(UserId); userid.setType(String.class); request.addProperty(userid); SoapSerializationEnvelope envp = new SoapSerializationEnvelope( SoapEnvelope.VER11); envp.dotNet = true; envp.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envp); SoapPrimitive response = (SoapPrimitive) envp.getResponse(); Response = response.toString(); } catch (Exception e) { e.printStackTrace(); } return Response; } @Override protected void onPostExecute(String result) { if (dialog != null) { if (dialog.isShowing()) { dialog.dismiss(); } } try { splitData = result.split("\\;"); username.setText(splitData[0]); URL newurl = new URL("" + WebsiteURL + "/images/profileImg/" + splitData[1] + ""); Bitmap mIcon_val = BitmapFactory.decodeStream(newurl .openConnection().getInputStream()); userphoto.setImageBitmap(mIcon_val); } catch (Exception e) { username.setText(e.toString()); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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