They have mentionned that the ERROR was occured while excecuting doInBackground()
public class NewClientActivity extends Activity { // Progress Dialog private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText name; EditText login; EditText password; EditText rePassword; EditText email; EditText adresse; EditText tel; // url to create new product private static String url_add_client = "http://192.168.1.3/android_connect/add_client.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity1); // Edit Text name = (EditText) findViewById(R.id.textViewNom); login = (EditText) findViewById(R.id.textViewLogin); password = (EditText) findViewById(R.id.textViewPassword); rePassword = (EditText) findViewById(R.id.textViewPassword1); email = (EditText) findViewById(R.id.textViewEmail); adresse = (EditText) findViewById(R.id.textViewAdresse); tel = (EditText) findViewById(R.id.textViewTel); // Create button Button btnAddClient = (Button) findViewById(R.id.connect); // button click event btnAddClient.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // creating new product in background thread new CreateNewProduct().execute(); } }); } /** * Background Async Task to Create new product * */ class CreateNewProduct extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(NewClientActivity.this); pDialog.setMessage("Adding Customer to DataBase.."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } /** * Creating product * */ protected String doInBackground(String... args) { String Name = name.getText().toString(); String Login = login.getText().toString(); String Password = password.getText().toString(); // String RePassword = rePassword.getText().toString(); String Email = email.getText().toString(); String Adresse = adresse.getText().toString(); String Tel = tel.getText().toString(); // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("Name", Name)); params.add(new BasicNameValuePair("Login", Login)); params.add(new BasicNameValuePair("Password", Password)); params.add(new BasicNameValuePair("Email", Email)); params.add(new BasicNameValuePair("Adresse", Adresse)); params.add(new BasicNameValuePair("Tel", Tel)); // getting JSON Object // Note that create product url accepts POST method JSONObject json = jsonParser.makeHttpRequest(url_add_client, "POST", params); // check log cat fro response Log.d("Create Response", json.toString()); // check for success tag try { int success = json.getInt(TAG_SUCCESS); if (success == 1) { // successfully created product // Intent i = new Intent(getApplicationContext(), AllProductsActivity.class); // startActivity(i); // closing this screen // finish(); } else { Toast.makeText(getApplicationContext(), "L'inscription n'a pas été éfectuée correctement", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { // dismiss the dialog once done pDialog.dismiss(); } } }
Please if you can check it out and tell me where the ERROR is ?? thank you in advance !!