The next time you post something, make sure to include a snippet of code. That way we can easily help you.
With regards to your question... what you have to do is open a new activity from the main activity. That's done by using intents and the startActivity
method. I'm gonna give you a simple example where there is only one day (the best day, friday!):
public class SchoolActivity extends Activity{
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.shool_layout);
// you have initialized your buttons here
// let's suppose this is the reference to your friday button
btnFriday.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// launch intent for friday
launchDay(DayDetails.FRIDAY);
}
});
}
private void launchDay(String whichDay){
Intent intent = new Intent(SchoolActivity.this, DayDetails.class);
intent.putExtra(DayDetails.DAY, whichDay);
startActivity(intent);
}
}
Then, on your day activity, you will show details for the specified day:
public class DayDetails extends Activity{
public static final String DAY = "day";
public static final String FRIDAY = "friday";
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.daylayout);
Bundle extras = getIntent().getExtras();
if( extras.getString(DAY).equals(FRIDAY) ){
// show things for the friday
}
}
}
Notice that you will have to create two layout files on the res/layout
folder; one for the main layout (in this case school_layout.xml
) and the other for the day details (daylayout.xml
). Hope this example help you and give you an idea of how to proceed in these cases.