Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 45
Registered: ‎10-25-2012
My Device: 8520
My Carrier: ss
Accepted Solution

twitter login problem

[ Edited ]

I want to use twitter login in my app , I want to push new screen after successful login , problem is that after login my program goes to callback url , how can I push  my new screen after twitter login?


My code is ----->


package mypackage;

import impl.rim.com.twitterapime.xauth.ui.BrowserFieldOAuthDialogWrapper;

import java.io.IOException;

import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;

import com.twitterapime.rest.Credential;
import com.twitterapime.rest.TweetER;
import com.twitterapime.rest.UserAccountManager;
import com.twitterapime.search.LimitExceededException;
import com.twitterapime.search.Tweet;
import com.twitterapime.xauth.Token;
import com.twitterapime.xauth.ui.OAuthDialogListener;
import com.twitterapime.xauth.ui.OAuthDialogWrapper;

public class TwitterAPIMERIMOAuthBrowserFieldSample extends UiApplication {
    public static void main(String[] args) {
        TwitterAPIMERIMOAuthBrowserFieldSample app = new TwitterAPIMERIMOAuthBrowserFieldSample();

    public TwitterAPIMERIMOAuthBrowserFieldSample() {
        pushScreen(new BrowserFieldScreen());

class BrowserFieldScreen extends MainScreen implements OAuthDialogListener {
    public BrowserFieldScreen() {
        setTitle("Twitter API ME - OAuth");
        BrowserField myBrowserField = new BrowserField();
        OAuthDialogWrapper loginWrapper =
            new BrowserFieldOAuthDialogWrapper(

    public void onAuthorize(Token token) {
        System.out.println("onAuthorize: " + token);
        UiApplication.getUiApplication().pushScreen(new MainScreen());


    public void onAccessDenied(String message) {
        System.out.println("access_denied: " + message);

    public void onFail(String error, String message) {
        System.out.println("error: " + error + " message: " + message);



plz help .

Posts: 45
Registered: ‎10-25-2012
My Device: 8520
My Carrier: ss

Re: twitter login problem

I have found the solution ,  I have given callbackurl is www.google.com, but if program redirect to this then url  is www.google.co.in ,so  string unmatch problem  is there , so onAuthorize() method never called . when I have given  url www.google.co.in , then it is working properly. 



how can I logout from twitter. plz help