Webview changing the url according to the day

1

I made a blog, to use only in this app, it is about liturgy, and every day there is a liturgy, so there are 365 liturgies, if I put 365 activity the app will get very heavy, so I thought I'd put one activity with webview, I wanted to know if I have to change only the webview link every day, for example, today is the 228th day of the year so it will display a url, tomorrow will be day 229 so it will display another url, only changing url's

Below is my webview

    String url = "https://paroquiasaoroqueblog.wordpress.com/228-2/";
    wv = (WebView) findViewById(R.id.webviewnsCarmo);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.getSettings().setPluginState(WebSettings.PluginState.ON);
    wv.getSettings().setAllowFileAccess(true);
    wv.setWebViewClient(new MyWebViewClient());
    wv.loadUrl(url);
    wv.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

obs: o 2 in the webview link is disregarded because it is automatically generated by the blog when publishing

    
asked by anonymous 17.08.2017 / 02:18

1 answer

4

You can concatenate the current day of the year in your URL using the Calendar class .

Example:

Calendar c = Calendar.getInstance();
String url = "https://paroquiasaoroqueblog.wordpress.com/" + c.get(Calendar.DAY_OF_YEAR) + "-2/";
    
17.08.2017 / 02:24