Created
February 22, 2011 20:29
-
-
Save eef/839323 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wellbaked.powerpanel; | |
// Android SDK Imports | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
// Java SDK Imports | |
import java.util.HashMap; | |
public class PowerPanel extends Activity { | |
// Creation of variable which will be used | |
private Dispatcher dispatcher; | |
TextView computer_count; | |
TextView text_view; | |
HashMap<String, Integer> actionList; | |
// Override the oncreate method of the extended Activity | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
// The creation of the dispatcher, all UI events will call this | |
createDispatcher(); | |
// Create a list of objects which will be interacted with | |
viewObjects(); | |
} | |
// Method to create an instance of the dispatcher class | |
private void createDispatcher() { | |
dispatcher = new Dispatcher(this); | |
} | |
// We created a hash map of view objects. String => Object | |
private void viewObjects() { | |
actionList.put("computer_count", R.id.computer_count); | |
} | |
// Update the choosen object, accepts a string which is used to pull the correct value from the actionList<String, Integer> | |
private void updateTextView(String tv) { | |
text_view = (TextView)findViewById(actionList.get(tv)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment