Category : string

I’m trying to get some text from my website and toast it, but I get android.os.NetworkOnMainThreadError when running var str = URL("https://server.necrodragon41.repl.co/server/connect").readText(Charset.forName("ISO-8859-1")) Toast.makeText(applicationContext, str, Toast.LENGTH_SHORT).show() And the app crashes. Here is my code: RegisterBtn.setOnClickListener { if (day.toString() != "0" && month.toString() != "0" && year.toString() != "0") { try { var t = Thread(Runnable { ..

Read more

website looks somewhat like this: dynamic webpage i need to copy all text from a dynamic webpage[keeps changeing for each second like there is a countdown/loading] for each second to a string previously i tried this code, private class BackTask extends AsyncTask<String, Integer, String> { @Override protected void onPreExecute() {} protected String doInBackground(String… address) { ..

Read more

I’m trying to change a bit display of string in android app. Now I’m using this string value : <string name="percent_off">%s OFF</string> But I wish it would return "- %s %". eg. "-54% " I have tried <string name="percent_off">- %s %</string> and <string name="percent_off">- %s %</string> But itseather crushing or not displaying any value at ..

Read more

I’m relatively new to Java so I’m kind of lost here. Is it wrong when you are trying to compare two strings just use the identical symbol "==" instead of using a method for checking if two strings are identical. Because for what I have tried the first option doesn’t work and I’m very curious ..

Read more

I’m getting concurrent exception replacing string inside iterator. fun replaceValuesInURLString(allFieldsValues: HashMap<String, UserSelectedData>, urlString: String): String { var result = urlString val iteratorValues = allFieldsValues.iterator() while(iteratorValues.hasNext()){ val fieldValue = iteratorValues.next() val key = "$${fieldValue.key}$" result = result.replace(key, fieldValue.value.getDataForReg()?: "") } //Regex replace to remove query param value’s which are not replaced by earlier code val cleanUpRegex ..

Read more