반응형
	Handler h;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_intro);
		
		setActivity();
	}
	
	@Override
	public void setActivity() {
		final LinearLayout linear = (LinearLayout)
				View.inflate(this, R.layout.activity_intro_dialog, null);
		
		new AlertDialog.Builder(this)
		.setTitle("Login Process")
		.setView(linear)
		.setPositiveButton("Login", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int whichButton) {
				h = new Handler();
				h.postDelayed(irun, 4000);
			}
		})
		.setNegativeButton("Exit", null)
		.show();
	}
	
	Runnable irun = new Runnable() {
		public void run() {
			Intent i = new Intent(IntroActivity.this, MenuActivity.class);
			startActivity(i);
			finish();
			
			overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
		}
	};

	@Override
	public void setListener() {	}

	public void goOtherActivity(String where) {	}

	public void warmToast(String msg) {	}
	
	public void onBackPressed() {
		super.onBackPressed();
		h.removeCallbacks(irun);
	}
반응형

WRITTEN BY
데르벨준

,