About the author

I am an Android developer for whom Android is the one and only love. I work as a freelancer which gets me and Android closer. I always love to share my learnings and love to learn from others knowledge too.

COMMENTS (10)
Reply

This is the best article , solve my all issues..Thank you for the article

Reply

How to send video with hashtag in twitter like image your sending??

Reply

I have used this code to compose tweet but getting TweitterSession error. Here, I attached log, please help me to resolved this issue.

final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
final Intent intent = new ComposerActivity.Builder(MainActivity.this)
.session(session)
.text(“Love where you work”)
.hashtags(“#twitter”)
.createIntent();
startActivity(intent);

Logs::
TwitterSession must not be null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalArgumentException: TwitterSession must not be null
at com.twitter.sdk.android.tweetcomposer.ComposerActivity$Builder.session(ComposerActivity.java:95)
at com.example.inextrix.twittereazydemo.MainActivity.onCreate(MainActivity.java:51)
at android.app.Activity.performCreate(Activity.java:6251)

    Hi Dharmesh,

    I think you have not authenticated user before composing. Check this shareUsingTwitterNativeComposer(View view) method where i am checking whether user session is null or not and if it is null then i am authenticating user.

    Thanks

Reply

Hello,
Thanks for help me. My above issue is solved app twitter working fine but now after some days I got error that com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token.

Please help to resolved this error.

    Hi Dharmesh,

    Can you tell me that it always gives the same error while doing fresh install of the application or on specific scenario this issue is coming?

    Thanks

Reply

When twitter app is not installed in device then this issue comes(If twitter app is installed then it open app). Moreover, this error I found in log.
Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings

Can you please tell me where I need to set callback url in code?

    Hi Dharmesh,

    In my previous article about Twitter Auth i mentioned how to set Callback URL.

    Actually Callback URL should be set in Apps under Twitter site.

    Thanks

Reply

Ok. Thanks.

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)