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
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Urgent: Code for submitting the form

Hi i am making the facebook login page in blackberry..The designing part is almost done bt i want to know how to provide the linking to the facebook??

 

As soon as the user enter the email id or password the account of the user is directly open..

 

Can anyone send the code for this...

 

Thanks in advance...

Please use plain text.
Developer
simon_hain
Posts: 16,215
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Urgent: Code for submitting the form

please refrain from using "Urgent", everybody who posts here has some kind of urgency.

you can use the search field to find the correct way to connect to facebook. there is the sdk and a sample project as well.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Urgent: Code for submitting the form

Here is the code.........

 

 

 

public class UiAppScreen extends MainScreen implements FieldChangeListener
{
    
    Bitmap bit;
    LabelField label,password,email_id,signup;
    BitmapField bitfield;
    EmailAddressEditField email;
    PasswordEditField pass;
    CheckboxField check;
    ButtonField button,sign1,button1;
    HrefField ref;
    Bitmap image=Bitmap.getBitmapResource("f.png");
    
    
    
    
    
    public UiAppScreen()
    {
    


        
        
        label= new LabelField("facebook",Field.FIELD_HCENTER);
        add(label);
        label.setMargin(30,20,20,20);
        label.setFont(Font.getDefault().derive(Font.BOLD,70));
        
        
        email_id= new LabelField("Email:");
        add(email_id);
        email_id.setMargin(20,10,10,0);
        
        email= new EmailAddressEditField("","");
        add(email);
        

        
        
        email.setEditable(true);
        XYEdges edge=new XYEdges(10,10,20,10);
        Border border= BorderFactory.createRoundedBorder(edge, Border.STYLE_SOLID);
        email.setBorder(border);
        
        
        password= new LabelField("Password: ");
        add(password);
        password.setMargin(20,10,10,0);
        
        pass= new PasswordEditField();
        add(pass);
        pass.setEditable(true);
        XYEdges edge1=new XYEdges(10,10,20,10);
        Border border1= BorderFactory.createRoundedBorder(edge1, Border.STYLE_SOLID);
        pass.setBorder(border1);
        
        check= new CheckboxField("Remember me",true);
        add(check);
        
        
        button= new ButtonField("Login",ButtonField.FIELD_HCENTER);
        button.setChangeListener(this);
        add(button);
        

        
        HorizontalFieldManager manager= new HorizontalFieldManager(Field.FIELD_HCENTER);
        
        ref=new HrefField("SignUp for facebook",0);
        ref.setChangeListener(this);
        ref.setMargin(10,10,10,10);
        manager.add(ref);
        add(manager);
        
        
        
        
        
    }
   
    
    public void fieldChanged(Field field, int context)
    {
       
 
      
        if(field==button1)
        {
            login();
        }
   
        
    }
    
    public void login()
    {
        String name=email.getText();
        String pass1=pass.getText();
     ;
        
        
        if(email.getTextLength()==0 && pass.getTextLength()==0)
        {
            
            UiApplication.getUiApplication().pushModalScreen(new CustomScreen(image, "Email/Password field cannot "+
            "\n"+"be left blank"));
        }
        else if(name.equalsIgnoreCase(id) && pass.getTextLength()==0)
        {
            
            UiApplication.getUiApplication().pushModalScreen(new CustomScreen(image, "Password is too short"));
        }
        else if(email.getTextLength()==0 && pass.getTextLength()>4)
        {
            
            UiApplication.getUiApplication().pushModalScreen(new CustomScreen(image, "Email field cannot be left blank"));
        }
        else if(email.getTextLength()>0 && pass.getTextLength()<4)
        {
        
            UiApplication.getUiApplication().pushModalScreen(new CustomScreen(image, "Password is too short"));
        }
        
        //else if(name.equalsIgnoreCase(id)  && (pass1.equalsIgnoreCase(password1) && pass.getTextLength()>4))
        //{
          
        //}
        else if(name!=id  || pass1!= password1)
        {
    
            UiApplication.getUiApplication().pushModalScreen(new CustomScreen(image, "You have entered an incorrect Email/Password combination"));
        }
        
    }
    
 }

 

 


Suppose my Fb id is vaishali@yahoo.com  and password is vaishali12

When i enter this and press the login button my facebook account would be open...

 

I want the code for this...

Please use plain text.