Android Course design Sixth day Welcome Interface (JUMP)

Source: Internet
Author: User

Note: The curriculum is designed to complete tasks, not to describe the details ~

 Packagecom.example.myapplication;Importandroid.app.Activity;Importandroid.content.Intent;ImportAndroid.os.Bundle;ImportAndroid.os.Handler;ImportAndroid.view.View;ImportAndroid.widget.TextView;/*** Created by cherry blossom fall Dance on 2017/6/13.*/ Public classJumpactivityextendsActivity {TextView TextView; intTime=3; Handler Handler=NewHandler (); @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.jump); TextView=(TextView) Findviewbyid (R.id.textview); Handler.postdelayed (runnable,1000); } Runnable Runnable=NewRunnable () {@Override Public voidrun () { time--; Handler.postdelayed ( This, 1000); Textview.settext ("+" +time+ "s"); if(time==0) {Intent Intent=NewIntent (jumpactivity. This, Testactivity.class);                StartActivity (Intent);            Finish (); }Else{Textview.setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (View v) {Intent Intent=NewIntent (jumpactivity. This, Testactivity.class);                        StartActivity (Intent); //End Threadhandler.removecallbacks (runnable);                    Finish ();            }                }); }        }    };}
 Packagecom.example.myapplication;Importandroid.content.Intent;Importandroid.support.v7.app.AppCompatActivity;ImportAndroid.os.Bundle; Public classMainactivityextendsappcompatactivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main); Intent.setclass (mainactivity. This, Jumpactivity.class);        StartActivity (Intent); Mainactivity. This. Finish (); } Intent Intent=NewIntent ();}
 Packagecom.example.myapplication;Importandroid.app.Activity;ImportAndroid.os.Bundle;Importandroid.support.annotation.Nullable;/*** Created by cherry blossom fall Dance on 2017/6/13.*/ Public classTestactivityextendsActivity {@Overrideprotected voidonCreate (@Nullable Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);    Setcontentview (r.layout.empty_activity); }}
<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:app= "Http://schemas.android.com/apk/res-auto"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context= "Com.example.myapplication.MainActivity"android:orientation= "vertical">    <ImageViewAndroid:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:src= "@mipmap/bg"/>    <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "+ 3 seconds"Android:id= "@+id/text"android:textsize= "20DP"Android:layout_alignparentright= "true"/></Relativelayout>
<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent">   <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "@mipmap /A"/></Relativelayout>
<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical">    <ImageViewAndroid:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:src= "@mipmap/bg"/>    <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:id= "@+id/textview"android:textsize= "20SP"Android:text= "+3s"Android:layout_alignparentright= "true"/></Relativelayout>
<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.myapplication">    <ApplicationAndroid:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_name"Android:roundicon= "@mipmap/ic_launcher_round"Android:supportsrtl= "true"Android:theme= "@style/apptheme">        <ActivityAndroid:name=". Mainactivity ">            <Intent-filter>                <ActionAndroid:name= "Android.intent.action.MAIN" />                <categoryAndroid:name= "Android.intent.category.LAUNCHER" />            </Intent-filter>        </Activity>        <ActivityAndroid:name=". Jumpactivity "Android:label= "@string/app_name"        >            <Meta-dataAndroid:name= "Android.support.PARENT_ACTIVITY"Android:value=". Mainactivity "/>        </Activity>        <ActivityAndroid:name=". Testactivity "Android:label= "@string/app_name">            <Meta-dataAndroid:name= "Android.support.PARENT_ACTIVITY"Android:value=". Mainactivity "/>        </Activity>    </Application></Manifest>

Android Course design Sixth day Welcome Interface (JUMP)

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.