Welcome!

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

Reply
Contributor
Posts: 39
Registered: ‎11-16-2010
My Device: 9800
My Carrier: airtel
Accepted Solution

Unable to go to next screen

Hi all,

                        I m trying to go to next screen in my app with the two credentials that i have entered in the first screen of my app. Here is the code for that situtation:

 

 

 

public void login() {
 // TODO Auto-generated method stub
   if(un.getTextLength()==0 || pass.getTextLength()==0)
 {
 Dialog.alert("please enter the credentials");
 }
   
    else if((String)un.getText() == "mohit" || (String)pass.getText() =="mohit" )
 {
   String username =un.getText();
 String drop=(String)ocf.getChoice(ocf.getSelectedIndex());
 LoginSuccess ls=new LoginSuccess(username, drop);
 UiApplication.getUiApplication().pushScreen(ls);
 }
 else
 {
 Dialog.alert("Incorrect Username or Password");
 }
 }

 

public void login() { // TODO Auto-generated method stub   if(un.getTextLength()==0 || pass.getTextLength()==0) { Dialog.alert("please enter the credentials"); }       else if((String)un.getText() == "mohit" || (String)pass.getText() =="mohit" ) {   String username =un.getText(); String drop=(String)ocf.getChoice(ocf.getSelectedIndex()); LoginSuccess ls=new LoginSuccess(username, drop); UiApplication.getUiApplication().pushScreen(ls); } else { Dialog.alert("Incorrect Username or Password"); } }

 

But after entering the correct Username and Password (mohit/mohit) i m not able to jump to next screen.

Plz help me . Any source code is regarding this problem will be great.

 

Thanks.

Developer
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: Unable to go to next screen

Rather using == try using equals function(s1.equals(s2)) of a String... then it will work!!

Contributor
Posts: 39
Registered: ‎11-16-2010
My Device: 9800
My Carrier: airtel

Re: Unable to go to next screen

Thanks kiran for all this.

but i have a question why my code is failing ?

Highlighted
Developer
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: Unable to go to next screen

Bcoz unlike C++... java doesnt provide operating Overloading!!!!!!