Eclipse provides an option to add the *.jar files in external libraries. 2009/10/29 Sj <soojung_h...@hanmail.net>
> > Hi, Android developers > > I am trying to create very simple 'http client using Jersey API'. > So I included Jersey library (such as jsr311-api-1.0.jar) as > Referenced Library. > > And my code build well. > But when I run it in Android Emulator, it seems the application > crashes. > The reason seems like ClassLoader of Android can't find the class > 'com.sun.jersey.api.client.Client'. > Anybody knows how to solve this? > > The code is following. > > package com.example.helloandroid; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.TextView; > > //Jersey Client API > import com.sun.jersey.api.client.Client; > import com.sun.jersey.api.client.WebResource; > > > public class HelloAndroid extends Activity > { > /** Called when the activity is first created. */ > > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > TextView tv = new TextView(this); > //tv.setText("Hello, Android"); > getHTTPJAXRS(tv); > setContentView(tv); > } > > public void getHTTPJAXRS(TextView tv) > { > String url = "http://www.google.com/"; > > Client myClient = Client.create(); > WebResource webres = myClient.resource(url); > > String s = webres.get(String.class); > tv.setText(s); > } > } > > > > > -- Shine bright, (: Naveen Krishna Ch :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---