Created
July 2, 2012 15:14
-
-
Save levinotik/3033716 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private static final int FOO_BUTTON_ID = 1; | |
private static final int BAR_BUTTON_ID = 2; | |
private ArrayList<View> views = new ArrayList<View>(); | |
public void onCreate(Bundle state) { | |
View v = findViewById(R.id.myView); | |
if(myDatabase.contains(foo)) { | |
Button b = new Button(this); | |
v.addView(b); | |
v.setId(FOO_BUTTON_ID); | |
views.add(b); | |
} else if(myDatabase.contains(bar)) { | |
Button b = new Button(this); | |
v.addView(b) | |
v.setId(BAR_BUTTON_ID) | |
views.add(b); | |
} | |
for(View v: views) { | |
if(v.getId==FOO_BUTTON_ID) ((TextView)v).setText("foo"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment