I have this exception and I was reading a thread on this, and it seemed confusing:
How to fix android.os.NetworkOnMainThreadException?
I already added this l
NetworkOnMainThreadException is thrown when your app tries networking operation in main thread.
To fix that you can use a private inner class within your Activity that extends android.os.AsyncTask
which will do the server call stuffs.
Something as,
private class SendfeedbackJob extends AsyncTask {
@Override
protected String doInBackground(String[] params) {
// do above Server call here
return "some message";
}
@Override
protected void onPostExecute(String message) {
//process message
}
}
And then invoke above class from submit.setOnClickListener
as below,
SendfeedbackJob job = new SendfeedbackJob();
job.execute(pass, email);
AsyncTask doc
AsyncTask Android example