Android interface Jump

Source: Internet
Author: User

Package Com.example.tianchu;

Import android.app.Activity;
Import Android.os.Bundle;
Import android.view.MotionEvent;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.view.Window;
Import Android.widget.RelativeLayout;
Import Android.widget.Toast;

public class Dialogactivity extends Activity {
Relativelayout linear = null;


@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);

Super.requestwindowfeature (Window.feature_no_title);

Super.setcontentview (R.layout.daactivity_main);

This.linear = (relativelayout) Super.findviewbyid (R.id.tianchu);
This.linear.setOnClickListener (New Onclicklistener () {

@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
Toast.maketext (Dialogactivity.this, "You clicked on this pop-up window,"

Toast.length_short). Show ();

}

});

}
public boolean ontouchevent (Motionevent event) {
TODO auto-generated Method Stub
This.finish ();//End this activity
Return Super.ontouchevent (event);

}

}

Package Com.example.tianchu;

Import Android.os.Bundle;
Import android.app.Activity;
Import android.content.Intent;
Import Android.view.Menu;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.view.Window;
Import Android.widget.Button;
Import Android.widget.Toast;

public class Mainactivity extends Activity {

protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Super.requestwindowfeature (window.feature_no_title);//get rid of the top title
Super.setcontentview (R.layout.activity_main);

Button mybut = (button) Super.findviewbyid (R.id.button1);
Mybut.setonclicklistener (New Onclicklistener () {

public void OnClick (View v) {//TODO auto-generated method stub
Toast.maketext (Mainactivity.this, "pop up a Window Oh",

Toast.length_short). Show ();
Intent Intent = new Intent (Mainactivity.this,
Dialogactivity.class);

MainActivity.this.startActivity (Intent);

}

});

}



}

17:51:53 2015-08-21

Android 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.