对于Android 2.2的客户端的Restlet [英] RESTLET Client for Android 2.2

查看:137
本文介绍了对于Android 2.2的客户端的Restlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Andr​​oid 2.2手机和SDK的Adroid 2.3.3(API 10)

和我想使用的Restlet为Android跟随我的手机使用REST客户端
的Restlet教程访问REST服务运行在 RESTURL 但每次当我安装这个应用程序无论是在手机和模拟器它崩溃的消息
意外停止,因此强制关闭。我曾尝试包括不同版本的Restlet 2.0.0一样,2.0.5,2.1平方米双方org.restlet.ext.httpclient.jar和org.restlet.jar但结果始终是强制关闭

谁能告诉我,如果我做错了什么?任何意见也将是
罚款的Andr​​oid 2.2 Restlful客户端

code:

  ClientResource CR =新ClientResource(http://androidgroundapps.appspot.com/rest/contacts/123);
    ContactResource资源= cr.wrap(ContactResource.class);
    //获取远程触点
    联系方式联系方式= resource.retrieve();    如果(接触== NULL){
        吐司(接触是空哥们!);
    }

联系人总是空!

下面是logcat的(我的应用程序的名称为的myapp <​​/ code>)

  E /无线(1361):android_net_wifi_getRssiHelper] RSSI -50
I / ActivityManager(1361):启动活动:意向{行动= android.intent.action。
主要猫= [android.intent.category.LAUNCHER] FLG = 0x10000000的CMP = com.androidground
.apps.myapp / .MyApp}
W / Flex的(1453):的getString FLEX_OPERATOR_ code打开
W / System.err的(9188):启动内部[HTTP / 1.1]客户端
I / ActivityManager(1361):显示活动com.androidground.apps.myapp / .MyApp:1414毫秒(共1414毫秒)
E /无线(1361):android_net_wifi_getRssiHelper] RSSI -53
W / System.err的(9188):停止内部[HTTP / 1.1]客户端
E /无线(1361):android_net_wifi_getRssiHelper] RSSI -51
E /圈养(1361):主动IFACE(USB0)报告为补充,忽略
D / WifiService(1361):广播接收器:android.intent.action.BATTERY_CHANGED


解决方案

在前面补充一点:

  Engine.getInstance()getRegisteredConverters()增加(新JacksonConverter())。;

但我只拿回LinkedHashMap中,我预计类型(联系)的对象。如果您管理的,告诉我,

I am using Android 2.2 phone and the Adroid SDK 2.3.3 (API 10)

And I am trying to use REST Client from my phone using RESTLET for Android following the tutorial given in RESTLET Tutorial to access the REST Service running on RESTURL But everytime when I install this application both in phone and emulator it crashes with message "Stopped Unexpectedly" and hence Force Close. I have tried to include both org.restlet.ext.httpclient.jar and org.restlet.jar of different RESTLET versions like 2.0.0, 2.0.5, 2.1m2 but the result is always "FORCE CLOSE"

Can anyone please tell me if I am doing something wrong? Any advice also would be fine on Restlful client in Android 2.2

Code:

ClientResource cr = new ClientResource("http://androidgroundapps.appspot.com/rest/contacts/123");
    ContactResource resource = cr.wrap(ContactResource.class);
    // Get the remote contact
    Contact contact = resource.retrieve();

    if(contact == null){
        toast("Contact is Null buddy!");
    }

contact is always null!!

Here is the logcat (my app's name is myapp):

E/wifi    ( 1361): [android_net_wifi_getRssiHelper] rssi -50
I/ActivityManager( 1361): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.androidground
.apps.myapp/.MyApp }
W/Flex    ( 1453): getString FLEX_OPERATOR_CODE OPEN
W/System.err( 9188): Starting the internal [HTTP/1.1] client
I/ActivityManager( 1361): Displayed activity com.androidground.apps.myapp/.MyApp: 1414 ms (total 1414 ms)
E/wifi    ( 1361): [android_net_wifi_getRssiHelper] rssi -53
W/System.err( 9188): Stopping the internal[HTTP/1.1] client
E/wifi    ( 1361): [android_net_wifi_getRssiHelper] rssi -51
E/Tethering( 1361): active iface (usb0) reported as added, ignoring
D/WifiService( 1361): BroadcastReceiver : android.intent.action.BATTERY_CHANGED

解决方案

Add this in front:

Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());

But i only get back a LinkedHashMap, i expect an Object of the type (Contact). If you manage that, tell me

这篇关于对于Android 2.2的客户端的Restlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆