I have a sample activity to display three diagrams in an array on button click.
What I'm trying to do now is update the original TextView string with every button click according to the button click.I have an idea of how to do it with numbers like this:
tView = (TextView) findViewById(R.id.textView1);
clickhere = (Button) findViewById(R.id.button1);
clickhere.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
num++;
String display = String.format(getString(R.string.prompt), num);
tView.setText(display);
setContentView(tView);
}
});
But how would I do this in the case of a string? I'm wondering is there a way to code it as on button click "one" then show relevant text,then on button click "two" show relevant text.The original text shows to tell the user what to do,then I want the text string to change below the diagram every time the button is clicked.So there will be a matching string to each of the three diagrams.
I'm not sure if you can implement it like that by counting button clicks,or is there a better way?