无法在android应用程序中实现rest webservice

无法在android应用程序中实现rest webservice,android,web-services,rest,Android,Web Services,Rest,我想在android应用程序中实现RESTWebService 这样做 我根据本教程创建类: 但是当我按下匹配的按钮时,我有一个错误 unfortunetly, android app has stopped 我的日志里没有任何东西 那我就不知道问题出在哪里了 以下是事件代码: case R.id.btn_rest_test : Log.d("method event get", "execite :)"); Rest r = new Rest();

我想在android应用程序中实现RESTWebService 这样做 我根据本教程创建类:

但是当我按下匹配的按钮时,我有一个错误

unfortunetly, android app has stopped
我的日志里没有任何东西 那我就不知道问题出在哪里了

以下是事件代码:

case R.id.btn_rest_test :
        Log.d("method event get", "execite :)");
        Rest r = new Rest();
        r.get("http://www.cheesejedi.com/rest_services/get_big_cheese.php?puzzle=1");
        r.getResponseString();
        EditText etdit = (EditText) findViewById(R.id.rest_text);
        EditText etdit2 = (EditText) findViewById(R.id.rest_error_text);
        etdit.setText(r.getResponseText());
        etdit2.setText(r.getError());
        break;

我怎样才能做到这一点呢?这可能是由于很多错误造成的

你确定它不会因为找不到你的两条文本而崩溃吗?
etdit.setText将导致NullPointerException。

您是否尝试检查响应,其内容如下:

时间戳:2012-04-09 22:50:52,{id:“977”,“level:“1”,“time_in_secs:“3”,“par:“0”,“首字母”,“WJF”,“quote:“dats right numerio uno”,“time_stamp:“2012-04-09 22:50:52”},{id:“977”,“level:“1”,“time_in secs:”3”,“par:“0”,“首字母”,“WJF”,“quote:“dats right numerio uno”,“time_:”2013-03-11 02:29:36“,“id:“874”,“level in”1”,“time_”,“secu”,“par”,“WJF:”首字母:“看,妈妈,没有手!”,“时间戳”:“2012-05-25 15:44:10”,{“id”:“59”,“level”:“1”,“时间秒”:“4”,“par”:“0”,“缩写”:“TMF”,“quote”:“Hey Hey ole'hickery”,“时间戳”:“2012-03-03 04:36:15”,{“id”:“61”,“level”:“1”,“时间秒”:“4”,“par”:“0”,“缩写”:“WJF”,“quote”:“我在船上”,“时间戳”:“2012-03-03:38:03”]

正如您所看到的,它的非响应将其设置为a ResponseArray。相应地修改它


还要检查它的类型是否为POST或GET

,很可能你正在主线程上执行此请求。这可能适用于Honeycoumb之前的版本,但在更高版本的android操作系统上,会抛出@laalto所指的NetworkOnMainThreadException。问题是Logcat是空的,没有任何东西我也遵循了此tuto并实现了它,但我保持w在Forveris等待完成请求您正在使用的url与示例中显示的url相同??抱歉,我忘了向您显示我测试的第二首tuto的链接,这里是:第一条评论是关于这第二首tuto的,没有错误,但我等待您下载完整的项目并尝试它…可能吗重置adb并检查u是否可以看到日志值