Luka Dragar February 2016

How to convert a number to another number?

I want to convert an Integer RAZ that I got from Preferences to a number that I will put in my webView.

For example:

1=69855 
2=69835
3=57545

 SharedPreferences sharedPreferences=getSharedPreferences("MyData", Context.MODE_PRIVATE);
    String URL_TEXT =sharedPreferences.getString("ucenec", NODATA);
    Integer RAZ =sharedPreferences.getInt("razred", DefaultValue);


myWebView.loadUrl("https://www.easAAAistent.com/urniki/073abf29d343404dac39228e470853f81ec774d8/razredi" + SLASH + RAZ + URL + URL_TEXT + "");`

If RAZ were 1 then the RAZ above would be 69855.

Answers


Onur Çevik February 2016

Add a switch statement for RAZ after initializing it:

.
.
.

switch (RAZ) {

    case 1:
        RAZ = 69855;
        break;
    case 2:
        RAZ = 69835;
        break;
    case 3:
        RAZ = 57545;
        break;
    default:
        break;
}

myWebView.loadUrl("https://www.easAAAistent.com/urniki/073abf29d343404dac39228e470853f81ec774d8/razredi" + SLASH + RAZ + URL + URL_TEXT + "");`

Post Status

Asked in February 2016
Viewed 3,123 times
Voted 6
Answered 1 times

Search




Leave an answer