Zhao yazhi _ name card holder (2) _ Automatic Logon

Source: Internet
Author: User

Function Description: log on to the application upon installation. When you Enable Automatic Logon, the application automatically enters the main interface.


Loginact. Java

Package COM. cards. activity; import android. app. activity; import android. content. intent; import android. content. sharedpreferences; import android. OS. bundle; import android. util. log; import COM. cards. commom. common; import COM. cards. commom. myApp; import COM. cards. r;/*** Note: Program portal (welcome page) ** @ author yazhizhao 2014-7-7 */public class welcomeact extends activity {private sharedpreferences sp; // temporary storage public locationclient mlocationclient = NULL; Public bdlocationlistener mylistener = new applocationlistener (); @ overridepublic void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. act_welcome); // used to safely exit MyApp. getinstance (). addactivity (this); thread t = new thread (r); T. start (); // start the opening animation} // start the animation thread runnable r = new runnable () {private string account; private string PWD; @ overridepublic void run () {try {thread. sleep (3000);} catch (interruptedexception e) {// todo auto-generated catch blocke. printstacktrace ();} sp = getsharedpreferences ("common_data", mode_private); account = sp. getstring ("acount", ""); Pwd = sp. getstring ("PWD", ""); If (account = "" & Pwd = "") {// enter the login interface intent = new intent (welcomeact. this, loginact. class); startactivity (intent);} else {// directly go to the homepage intent = new intent (welcomeact. this, premieract. class); startactivity (intent) ;}finish () ;};@ overrideprotected void onstart () {// used to safely exit MyApp. getinstance (). addactivity (this); super. onstart () ;}@ overrideprotected void ondestroy () {common. destroyloading (welcomeact. this); finish (); super. ondestroy ();}}



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.