标签:
import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends Activity { ViewPager mViewPager; protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mViewPager = (ViewPager) findViewById(R.id.vp); PagerAdapter mPagerAdapter = new myAdapter(this); mViewPager.setAdapter(mPagerAdapter); Log.e("MainActivity", "=========开始创建"); Button button = (Button) findViewById(R.id.btn); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ActivityB.class); startActivity(intent); } }); } @Override protected void onPause() { super.onPause(); Log.e("MainActivity", "=============暂停"); } protected void onDestroy() { Log.e("MainActivity", "=============完全退出"); super.onDestroy(); } @Override protected void onRestart() { Log.e("MainActivity", "=============重新开始"); super.onRestart(); } @Override protected void onResume() { Log.e("MainActivity", "=============正在运行"); super.onResume(); } @Override protected void onStart() { Log.e("MainActivity", "=============开启"); super.onStart(); } @Override protected void onStop() { Log.e("MainActivity", "=============结束"); super.onStop(); }
标签:
原文地址:http://www.cnblogs.com/labixiaoxin/p/4933599.html