IOS-like Launch welcome page

Source: Internet
Author: User

Activity interface:

Welcome_layout.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    android:background="@drawable/welcome_pic"    >    </LinearLayout>

Activity Code:

Package com. activity; import android. annotation. suppressLint; import android. app. activity; import android. content. intent; import android. OS. bundle; import android. OS. handler; import android. OS. message; import com. tqg. zhenjiang. price. r; @ SuppressLint ("HandlerLeak") public class WelcomeActivity extends Activity {// delay time private final static int DELAY_TIME = 1500; // Message Parameter private final static int DELAY_MSG = 1001; @ SuppressLint ("HandlerLeak") @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. welcome_layout); // delay message mHandler. sendEmptyMessageDelayed (DELAY_MSG, DELAY_TIME);} private final Handler mHandler = new Handler () {@ Override public void handleMessage (Message msg) {switch (msg. what) {case DELAY_MSG: startToMainActivity (); WelcomeActivity. this. finish (); break; default: break;} super. handleMessage (msg) ;}}; // jump to the main interface private void startToMainActivity () {Intent intent = new Intent (); intent. setClass (this, MainActivity. class); startActivity (intent );}}

The Android Handler is used to send messages in a delayed manner.

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.