如何使用Twitter的API在我的Andr​​oid应用程序中实现只能跟着按钮 [英] how to use twitter api in my android application to implement follow button only

查看:166
本文介绍了如何使用Twitter的API在我的Andr​​oid应用程序中实现只能跟着按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我是通过在Twitter上实现各个环节都没有了。

Hi Guys I have gone through various links over twitter implementation.

我能够成功鸣叫,并从Twitter获得我的追随者。现在,下一个任务就是按照我们的Twitter的功能,在我的应用程序。谁能告诉我,以实现它的简单方法。

I'm successfully able to tweet and get my followers from twitter. Now the next task is to follow us functionality of twitter in my app. Can anyone tell me the simple way to implement it.

我卡从最后一天。无法摆脱这一点。请不要拿这个问题的否决和各种事情。这将是巨大的,如果有人能向我提供任何样品code URL和直接的方式回答。

I'm stuck from last one day. Not able to get rid of this. Please dont take this question for voting down and various things. It would be great if someone can provide me any sample code url and straight way answer to it.

下面是我已经走过的链接:

Here's the links I have gone through:

https://dev.twitter.com/docs/follow-button

的Andr​​oid,微博,跟美国的

https://dev.twitter.com/discussions/9515

<一个href="https://$c$c.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167" rel="nofollow">https://$c$c.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167

请帮我摆脱这个问题。

哈里

推荐答案

我找出解决办法。我成功地能够按照任何用户。以下是工作的精绝的链接。 <一href="http://$c$c.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167" rel="nofollow">http://$c$c.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167

I find out solution. I am successfully able to follow any user. Following is link that is working absolutely fine. http://code.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167

code: -

    new TwitterTestAsync().execute(); // CALL THIS CLASS IN YOUR MAIN (CREATE) METHOD.
    private class TwitterTestAsync extends AsyncTask<Void, Void, Void>{

    @Override
    protected Void doInBackground(Void... params) {
        // TODO Auto-generated method stub

        try{
            doTwitterTask();
        }catch(Exception e){
            e.printStackTrace();
        }

        return null;
    }

}
    private void doTwitterTask(){
    screenName  =   "chetan_bhagat";
    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true)
    .setOAuthConsumerKey("WRITE HERE YOUR CONSUMER KEY")
    .setOAuthConsumerSecret("WRITE HERE YOUR CONSUMER SECRET KEY")
    .setOAuthAccessToken("WRITE YOUR TOKEN STRING")
    .setOAuthAccessTokenSecret("WRITE YOUR TOKEN SECRET STRING");
    TwitterFactory tf = new TwitterFactory(cb.build());
    Twitter twitter = tf.getInstance();                 

    try {


        twitter.createFriendship(screenName);

    } catch (TwitterException e) {

        e.printStackTrace();
    }

}

这篇关于如何使用Twitter的API在我的Andr​​oid应用程序中实现只能跟着按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆