0
I’m making an app, which when I go into it, it detects the date and it already shows the acitivity for that date, how do I do that? for example today 07/08 then it will show the Activity set to the date 07/08
0
I’m making an app, which when I go into it, it detects the date and it already shows the acitivity for that date, how do I do that? for example today 07/08 then it will show the Activity set to the date 07/08
3
If it is weekly, it can be something simple using the Calendar.DAY_OF_WEEK
. Behold:
// resgata a data atual
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_WEEK);
Intent i = null;
switch (day) {
case Calendar.SUNDAY:
i = new Intent(this, DomingoActivity.class);
case Calendar.MONDAY:
i = new Intent(this, SendaActivity.class);
case Calendar.TUESDAY:
i = new Intent(this, TercaActivity.class);
.
.
.
//etc
}
startActivity(i);
2
Instead of changing Activity each day, try to create a layout from which you can exchange your content as needed. You could specify more what type of content you want to put in this Activity.
The ideal would be for you to have a place to search for the day’s content, such as a web service. Thus, you would download the material of the day and update the components of this Activity.
If you just want to perform tests, try saving some images in the folder assets
and update according to the day.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.