StartActivity.javapublicclassStartActivityextendsActivity{privateButtonloginBtn=null;protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);se...
StartActivity.java
public class StartActivity extends Activity {
private Button loginBtn = null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
loginBtn = (Button)this.findViewById(R.id.login_btn);
loginBtn.setOnClickListener(new LoginBtnClickListener()); }
private final class LoginBtnClickListener implements View.OnClickListener{
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(StartActivity.this, LoginActivity.class);
startActivity(intent);} }
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true; }
}
LoginActivity.java
package com.example.loginpagedemo;
import android.app.Activity;
import android.os.Bundle;
public class LoginActivity extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_page); } }
展开