estou com erro nesse codigo ele trava e fecha a aplicação por favor me ajudem
public class AddClientes extends Activity {
// Progress Dialog
private ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
EditText inputplaca;
EditText inputnome;
EditText inputemail;
// url to create new product
private static String url_create_product= "http://192.168.0.123/sgeit/create_product.php";
// JSON Node names
private static final String TAG_SUCCESS = "success";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.telacadastro);
// Edit Text
inputplaca = (EditText) findViewById(R.id.inputplaca);
inputnome = (EditText) findViewById(R.id.inputnome);
inputemail = (EditText) findViewById(R.id.inputemail2);
// Create button
Button btnCadastra = (Button) findViewById(R.id.btncadastra);
//button click event
btnCadastra.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//creating new product in background thread
new CriarnovoCliente().execute();
}
});
}
/**
* Background Async Task to Create new product
* */
class CriarnovoCliente extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(AddClientes.this);
pDialog.setMessage("Cadastrando...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
/**
* Creating product
* */
protected String doInBackground(String... args) {
String placa = inputplaca.getText().toString();
String nome = inputnome.getText().toString();
String email = inputemail.getText().toString();
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("placa", placa));
params.add(new BasicNameValuePair("nome", nome));
params.add(new BasicNameValuePair("email", email));
// getting JSON Object
// Note that create cliente url accepts POST method
JSONObject json = jsonParser.makeHttpRequest(url_create_product,
"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 cliente
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
// closing this screen
finish();
} else {
}
} 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();
}
}
}