Using the Mina framework to develop QQ Android client (3) Landing function implementation

Source: Internet
Author: User
Tags gettext tostring

In the blog has the landing interface article http://blog.csdn.net/vestigge/article/details/8124674

It's not repeated, just look at the login code,

Passing the string with Mina has been looked at, and to implement the object is also very simple, only need to modify the filter:

Chain.addlast ("Codec", new Protocolcodecfilter (new objectserializationcodecfactory));

In the Android client, the logged in activity:

 public class Loginactivity extends activity{private edittext accountedittext;  
    Private EditText Passwordedittext;  
          
     Private CheckBox Remebercheckbox;  
            public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);  
            Requestwindowfeature (Window.feature_no_title);  
            Setcontentview (R.layout.activity_login);  
            accountedittext= (EditText) Findviewbyid (R.id.login_account);  
            passwordedittext= (EditText) Findviewbyid (R.id.login_password);  
                  
            remebercheckbox= (CheckBox) Findviewbyid (R.id.login_remember);  
                    Findviewbyid (R.id.login_login). Setonclicklistener (New Onclicklistener () {public void OnClick (View v) {   
                            if (Accountedittext.gettext (). toString (). Equals ("") | | Passwordedittext.gettext (). toString (). Equals ("")) {Toast.maketext (loginactivity. This, "The account or password cannot be empty!"  
                    ", Toast.length_short). Show ();  
                        }else{User User=new User ();  
                        User.setaccount (Integer.parseint (Accountedittext.gettext (). toString ()));  
                        User.setpassword (Passwordedittext.gettext (). toString ());  
                        User.setoperation (Vqmessagetype.login);  
                        Boolean b=new vqclient (). Sendlogininfo (user); If the login succeeds if (b) {Toast.maketext (loginactivity.this, "Login successful!")  
                            ", Toast.length_short). Show ();  
                        StartActivity (New Intent (Loginactivity.this,mainactivity.class)); }else{Toast.maketext (loginactivity.this, "Connection timed out, Login failed!")  
                        ", Toast.length_short). Show ();  
     }  
                    }  
                }  
            }); }  
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.