B4J Library jTwitter Class

Hi all ,

I was trying to get an easy way to use twitter API 1.1 for B4A and was testing on B4J .
I succeeded on B4J but for B4A I could not .
Anyway this class is not complete but you can add new functions from the main library as you wish
The main library is JTwitter Library http://www.winterwell.com/software/jtwitter.php . Feel free to add new functions and if you got lucky porting it to B4A please share with us :)

You need to copy the following JARs to Libraries folder

jtwitter
signpost-core-1.2.1.1
commons-codec-1.3
signpost-commonshttp4-1.2.1.1

Do not forget to add the references :

B4X:
    #AdditionalJar: jtwitter
    #AdditionalJar: signpost-core-1.2.1.1
    #AdditionalJar: commons-codec-1.3
    #AdditionalJar: signpost-commonshttp4-1.2.1.1


Then add the class to your project

Simple example to get description of twitter accounts returned by searching "Basic4Android"


B4X:
    Dim twittr As jTwitter
  
  
    twittr.Initialize(consumerKey,consumerSecret,File.DirApp,"accc",False)
    Dim users As List=twittr.SearchUsers("Basic4android")
    For uz=0 To users.Size-1
        Log(twittr.GetUserField(users.Get(uz),"description"))
    Next

I hope that helps and if I am doing something in a wrong way please let me know - I am still a beginner.
 

Attachments

  • jTwitter.bas
    3.3 KB · Views: 467
Top