in an activity I load some text values from a custom object.
These text values go into textViews, the textViews are displayed on screen.
I have previous and next buttons that, when tapped, should refresh the textViews with the new values.
Here is some code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
myObj = (Object)getIntent().getSerializableExtra("Stuff");
myTextView.setText(myObj.currentData().getText());
prevButton = (Button) findViewById(R.id.prevButton);
nextButton = (Button) findViewById(R.id.nextButton);
prevButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.d("TAG", "prevButton tapped");
myObj.prevData();
//Would like to call refresh view here
}
});
nextButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.d("TAG", "nextButton tapped");
myObj.nextData();
//Would like to call refresh view here too
}
});
}
Now I notice that when I hit the previous or next buttons and then rotate the device, the view updates. I am trying to reproduce that without rotating the device.
Thanks