users@jersey.java.net

[Jersey] Android and jersey problem

From: FLORE <hayfa_best_at_yahoo.fr>
Date: Thu, 22 Mar 2012 08:20:45 -0700 (PDT)

Hi friends,
can some one help me how to use jersey on android ?
i try to use this code in simple java project an it's work great butwhen i
use it on android project i have java null pointer exception :

public class TimerActivity extends Activity {
    /** Called when the activity is first created. */
    static WebResource service;
        static ClientResponse response;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
             int c=1;
        setContentView(R.layout.accueil);
                 ClientConfig config = new DefaultClientConfig();
                 config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
Boolean.TRUE);
                 Client client = Client.create(config);
                 service = client.resource("http://192.168.1.167:8080/");
                 Timer t = new Timer();
                 t.setId(2L);
                 t.setMessage(" first example Rest Client ");
                 int code = createNewTimer(t);
     }
         
     public static int createNewTimer(Timer t){
                 response = service
                                 .path("g")
                                 .path("timers")
                                 .accept(MediaType.APPLICATION_JSON)
                                 .post(ClientResponse.class, null);
                 return response.getStatus();
         }
                     
     
 }

--
View this message in context: http://jersey.576304.n2.nabble.com/Android-and-jersey-problem-tp7395791p7395791.html
Sent from the Jersey mailing list archive at Nabble.com.