jTwitter throwing NullPointerException when trying to post the same status twice

26 views
Skip to first unread message

Matteo

unread,
Jan 11, 2012, 9:29:06 PM1/11/12
to JTwitter
Hello,
I'm using Eclipse Indigo, and on my simulator if I try to post the
same message twice the application instead of returning a
TwitterException throws a runtime java.lang.NullPointerException.
Is there any way to avoid it? I tried both with AsyncTask and normal
Activity, but no luck so far.


public void onClick(View v)
{
String status = editText.getText().toString();
try
{
try
{
YambaApplication yamba = (YambaApplication)
getApplication();
winterwell.jtwitter.Status twitterStatus =
yamba.getTwitter().updateStatus(status);
Toast.makeText(StatusActivity.this, twitterStatus.getText(),
Toast.LENGTH_LONG).show();
} catch (TwitterException e)
{
Toast.makeText(StatusActivity.this, "Twitter Error: " +
e.toString(), Toast.LENGTH_LONG).show();
}
} catch (RuntimeException e)
{
Toast.makeText(StatusActivity.this, "Runtime Error: " +
e.toString(), Toast.LENGTH_LONG).show();
}

Log.d(TAG, "button in PostToTwitter onClick 'ed");
}

Daniel Winterstein

unread,
Jan 12, 2012, 3:18:22 PM1/12/12
to jt...@googlegroups.com
Hi Matteo,
Which version of JTwitter are you using? (have a look at
Twitter.version if you're not sure)
& could you send a stacktrace?
Best regards,
- Daniel

--
--------------------------------------------------
Daniel Winterstein
Edinburgh
http://winterwell.com   http://soda.sh

Matteo

unread,
Jan 12, 2012, 9:50:43 PM1/12/12
to JTwitter
Hi Daniel,
The version I was using is 2.3.1, I just upgraded to 2.3.8 and now all
works fine: posting a message twice throws correctly a
TwitterException.

Thank you for your help
Matteo

Daniel Winterstein

unread,
Jan 13, 2012, 5:31:41 AM1/13/12
to jt...@googlegroups.com
I'm glad it was an easy fix!
Best regards,
- Daniel

--

Reply all
Reply to author
Forward
0 new messages