twitter - Sending tweets using Android -


I want to send a tweet from Android. I have executed the following code. But I'm not bundled to send any tweets. Unbelievably the button I created was not working. Can anyone talk to me?

This is my code ..

  import android.app.activity; Import android.content.ActivityNotFoundException; Import android.content.Intent; Importroid.os.Bundle; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.Button; Importroid.os.Bundle; Public Square TwidgitPublicIntent Activity Remove OnClickListener {Personal Static Final Full TWIDGIT_REQUEST_CODE = 2564; /** Called when the activity is first created. * / @ Override Crate on Public Zero (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); SetContentView (R.layout.main); . (Button) findViewById (R.id.tweet_button) setOnClickListener (this); . (Button) findViewById (R.id.mention_button) setOnClickListener (this); . (Button) findViewById (R.id.retweet_button) setOnClickListener (this); . (Button) findViewById (R.id.message_button) setOnClickListener (this); } Click on Public Zero (see V) {Switch (v.getId ()) {Case R.id.tweet_button: // Standard Tweet Intent tIntent = New Intent ("com.disretrospect.twidgit.TWEET"); TIntent.putExtra ("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_"); Try {This.startActivityForResult (tIntent, TWIDGIT_REQUEST_CODE); } Catch (ActivityNotFoundException e) {// if the tweetgit is not installed} break; Case R.id.mention_button: // Attention means mIntent = new intent ("com.disretrospect.twidgit.MENTION"); MIntent.putExtra ("com.disretrospect.twidgit.extras.TO", "_username_to_xmention_"); MIntent.putExtra ("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_"); Try {This.startActivityForResult (mIntent, TWIDGIT_REQUEST_CODE); } Catch (ActivityNotFoundException e) {// if the tweetgit is not installed} break; Case R.id.retweet_button: // The Inventor of a Tweet Intent rtIntent = New Intent ("com.disretrospect.twidgit.RETWEET"); RtIntent.putExtra ("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_"); RtIntent.putExtra ("com.disretrospect.twidgit.extras.VIA", "_original_author_of_tweet_name_"); Try this {Start.startActivityForResult (rtIntent, TWIDGIT_REQUEST_CODE); } Catch (ActivityNotFoundException e) {// if the tweetgit is not installed} break; Case R.id.message_button: // send DM means dmIntent = new intent ("com.disretrospect.twidgit.DIRECT_MESSAGE"); DmIntent.putExtra ("com.disretrospect.twidgit.extras.TO", "_username_to_send_dm_to_"); DmIntent.putExtra ("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_"); Try this {Start.startActivityForResult (dmIntent, TWIDGIT_REQUEST_CODE); } Catch (ActivityNotFoundException e) {// if the tweetgit is not installed} break; }} @ Override activate result at zero protected (int requestcode, int result result, intent data) {super.onActivityResult (requestCode, resultCode, data); // Czech result code if (resultCode == activity. RESULT_OK) {// check requestcode switch (requestcode) {case TWIDGIT_REQUEST_CODE: // handle successful return break; }} And if (resultcode == activity. RESULT_CANCELED) {// handle cancellation}}}  

I can not edit your post, so I have to answer it: can you provide more information about this problem? More accurate, "Is the button not working?" Is something happening when you click the button or not? If nothing happens, then you may run in ActivityNotFoundException. Since it has been caught, but no action has been taken, it is transparent. Have you tried debugging with a breakpoint on onClick method?


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -