我正在尝试将值存储在我的 android 的数据库中。我能够存储这些值,但我的问题是,当我检查将值存储在数据库中时,我的应用程序在那个特定的实例中崩溃了,我可以找到错误。
请任何人帮助我解决这个问题。这是我的短代码。
ResponseHandler<String> responseHandler = new BasicResponseHandler();
final String response = httpclient.execute(httppost, responseHandler);
System.out.println("Response : " + response);
if(response.equalsIgnoreCase("Entered data successfully")){
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(lifequality.this,"Inserted Successully", Toast.LENGTH_SHORT).show();
}
});
myIntent=new Intent(lifequality.this, menu.class);
String uname;
uname=myValues.getString("value").toString();
myIntent.putExtra("value", uname);
startActivity(myIntent);
}else{
showAlert();
startActivity(new Intent(lifequality.this, lifequality.class));
}
}catch(Exception e){
dialog.dismiss();
System.out.println("Exception : " + e.getMessage());
}
}
public void showAlert(){
lifequality.this.runOnUiThread(new Runnable() {
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(lifequality.this);
builder.setTitle("error in inserting.");
builder.setMessage("not inserted.")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}