简体   繁体   中英

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.

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 + "");`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM