#2
jianghao20142015-05-12 21:30
|
package com.example.gclion2;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn1=(Button)findViewById(R.id.btnLoad);
Button btn2=(Button)findViewById(R.id.btnExit);
//跳转到登陆界面
btn1.setOnClickListener(new OnClickListener()
{ public void onClick(View v)
{
Intent intent=new Intent(MainActivity.this, LandActivity.class);
MainActivity.this.startActivity(intent);
MainActivity.this.finish();
}
});
//退出
btn2.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
MainActivity.this.finish(); //关闭页面
}
});
// new Handler().postDelayed(new Runnable(){
// public void run() {
// TODO Auto-generated method stub
// Intent intent = new Intent(MainActivity.this, LandActivity.class);
// startActivity(intent);
// MainActivity.this.finish();
// }
//}, 2000);//两秒后跳转到内容页
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}