K.Muthu
K.Muthu

Reputation: 1252

android twitter post code

I tried this code for twitter :

    twitter = new Twitter("username","password");
   
    try
    {
        //Status to post in Twitter
        twitter.setStatus(ACCESSIBILITY_SERVICE);
        Toast.makeText(TwitterExample.this, "Article Posted to Twitter  Successfully!!", Toast.LENGTH_SHORT).show();
    }
    catch(TwitterException.E401 e)
    {
        // comes here when username or password is wrongs 
        Toast.makeText(TwitterExample.this, "Wrong Username or Password,Kindly Check your logins",Toast.LENGTH_SHORT).show();
    }
    catch(Exception e)
    {
        Toast.makeText(TwitterExample.this, "Network Host not responding",Toast.LENGTH_SHORT).show();
    }

I got this error :

FATAL EXCEPTION: main
java.lang.NoSuchMethodError: java.lang.String.isEmpty
 at winterwell.jtwitter.URLConnectionHttpClient.processError2_reason(URLConnectionHttpClient.java:442)
 at winterwell.jtwitter.URLConnectionHttpClient.processError(URLConnectionHttpClient.java:365)
 at winterwell.jtwitter.URLConnectionHttpClient.post2(URLConnectionHttpClient.java:303)
 at winterwell.jtwitter.URLConnectionHttpClient.post(URLConnectionHttpClient.java:272)
 at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2593)
 at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2519)
 at winterwell.jtwitter.Twitter.setStatus(Twitter.java:2291)
 at org.androidpeople.twitter.TwitterExample.onCreate(TwitterExample.java:24)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 at android.app.ActivityThread.access$2300(ActivityThread.java:125)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:123)
 at android.app.ActivityThread.main(ActivityThread.java:4627)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:521)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 at dalvik.system.NativeStart.main(Native Method)

Any help much appreciated.

Thanks.

Upvotes: 0

Views: 412

Answers (1)

FunkTheMonk
FunkTheMonk

Reputation: 10938

You're using the java jar file, rather than the android jar.

Upvotes: 2

Related Questions