I have two activities
The first one gets some data from a content provider, and displays it
The second activity has a button, and when clicked it should call the first activity to "refresh", in other words to reload data from the content provider
This is my first activity
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contactsview);
// Grab data and put it onto screen
getDataAndPutToUI();
}
@Override
public void onStart()
{
//Refresh data
getDataAndPutToUI();
}
...
And this is my second activity
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.optionsview);
Button button = (Button) findViewById(R.id.intentButton);
button.setOnClickListener(this);
}
// This is bound to the "refresh" button
@Override
public void onClick(View v) {
// Call first activity, to reload the contacts
Intent i = new Intent(this, FirstActivity.class);
startActivity(i);
}
Is this the correct way to be implementing such functionality? It feels incorrect, but I can't determine any reasons to backup my claims