Search code examples
androidquery-stringhttp-getquerystringparameter

How to update certain parameters in HTTP GET query string in Android?


I'm gonna build an application when elements are chosen from menu and their corresponding query string's parameters must change in order to display information:

Query string example: "?inst=8&group=4420&semestr=1&semest_part=2". Can you tell how to do this?


Solution

  • use String.format

    int inst = 8;
    int group = 4420;
    int semestr = 1;
    int semestr_part = 2;
    String query = String.format("?inst=%d&group=%d&semestr=%d&semest_part=%d", inst, group, semestr, semestr_part);