Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android get在检查phpresponse时失败_Php_Android - Fatal编程技术网

Android get在检查phpresponse时失败

Android get在检查phpresponse时失败,php,android,Php,Android,我正在尝试将这些值存储在android中的数据库中。我可以存储这些值,但我的问题是,当我检查是否将这些值存储在数据库中时,我的应用程序在某个特定实例上崩溃,我可以找到错误 请任何人帮我解决这个问题。这是我的短代码 ResponseHandler<String> responseHandler = new BasicResponseHandler(); final String response = httpclient.execute(httppost, respo

我正在尝试将这些值存储在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();               
            }
        });
}
ResponseHandler ResponseHandler=new BasicResponseHandler();
最终字符串响应=httpclient.execute(httppost,responseHandler);
System.out.println(“响应:+Response”);
if(response.equalsIgnoreCase(“成功输入数据”)){
runOnUiThread(新的Runnable(){
公开募捐{
Toast.makeText(lifequality.this,“插入成功”,Toast.LENGTH_SHORT.show();
}
});
myIntent=新意图(lifequality.this、menu.class);
字符串uname;
uname=myValues.getString(“value”).toString();
myIntent.putExtra(“值”,uname);
星触觉(myIntent);
}否则{
showarert();
startActivity(新意图(lifequality.this、lifequality.class));
}
}捕获(例外e){
dialog.dismise();
System.out.println(“异常:+e.getMessage());
}
}
公开作废showAlert(){
lifequality.this.rununuithread(新的Runnable(){
公开募捐{
AlertDialog.Builder=新建AlertDialog.Builder(lifequality.this);
setTitle(“插入时出错”);
builder.setMessage(“未插入”)
.setCancelable(错误)
.setPositiveButton(“确定”,新的DialogInterface.OnClickListener(){
public void onClick(DialogInterface对话框,int-id){
}
});                     
AlertDialog alert=builder.create();
alert.show();
}
});
}

我已经解决了我的问题。为了帮助我在这里发布答案的人。 请通过调试模式检查您的响应,因为我得到的响应是“已成功插入/r/n/n”。我在调试模式下找到的。你也很高兴,因为它和问题可以解决