Back to project page L5RHelper.
The source code is released under:
Copyright (c) 2010 Robert Uhl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...
If you think the Android project L5RHelper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.uhl; //from www . j ava 2 s .c o m import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class HomeActivity extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); registerButtons(); } private void registerButtons() { (this.<Button>getView(R.id.create_new)).setOnClickListener(this); (this.<Button>getView(R.id.load_existing)).setOnClickListener(this); } @SuppressWarnings("unchecked") public <T extends View> T getView(int id) { T result = null; try{ result = (T)findViewById(id);} catch(Exception e){ } return result; } @Override public void onClick(View e) { Button button = this.<Button>getView(e.getId()); switch(button.getId()){ case R.id.create_new:StartActivity(EditCharacterActivity.class);break; case R.id.load_existing:StartActivity(LoadProfileView.class);break; default: break; } } private void StartActivity(Class<?> classInput) { this.startActivity(new Intent(this, classInput)); } }