如何使用Twitter的API在我的Andr​​oid应用程序中实现只能跟着按钮我的、如何使用、应用程序、按钮

2023-09-06 01:25:09 作者:月亮指挥官

大家好我是通过在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

https://$c$c.google.com/p/android-hackathon-in-fukuoka/source/browse/trunk/sodefuri/src/jp/jagfukuoka/sodefuri/TimeLineActivity.java?spec=svn167&r=167

请帮我摆脱这个问题。

哈里

推荐答案

我找出解决办法。我成功地能够按照任何用户。以下是工作的精绝的链接。 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();
    }

}