Я вставляю свои данные в MySql
, и данные вставляются успешно. Но я не могу до Intent
к другому Activity
после успешной операции.
Вот мой код:Не удалось выполнить намерение после вставки данных в mysql
public void registerfinish(View view) {
...
new finalRegister().execute();
}
class finalRegister extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
...
}
/**
* getting All products from url
* */
protected String doInBackground(String... args) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
...
// getting JSON Object
// Note that create product url accepts POST method
JSONObject json = null ;
try {
json = jsonParser.makeHttpRequest(url,
"GET", params);
} catch (JSONException e) {
e.printStackTrace();
}
// check for success tag
try {
// check log cat fro response
Log.d("Create Response", json.toString());
success = json.getInt(TAG_SUCCESS);
} catch (JSONException e) {
e.printStackTrace();
}
if (success == 1) {
// successfully created product
Intent i = new Intent(Register2ndStep.this, FinalScreen.class);
startActivity(i);
// closing this screen
//finish();
} else {
...
}
return null;
}
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
}
}
}
Logcat:
Caused by: java.lang.NullPointerException
at wolverine.example.com.btp_scientist.Register2ndStep$finalRegister.doInBackground(Register2ndStep.java:220)
at wolverine.example.com.btp_scientist.Register2ndStep$finalRegister.doInBackground(Register2ndStep.java:173)
Register2ndStep.java:220: Log.d("Create Response", json.toString())
Register2ndStep.java:173: class finalRegister extends AsyncTask<String, String, String>
http://stackoverflow.com/a/13296114/ 4070044 - посмотрите –
@shine_joseph это не сработало для меня .. – adafrwefsefr