Category : string

Please suggest improvements on this code. I want to achieve is: 51.42ºN, 145.20ºW. Also it would be great if any tool is recommended or online code analysis. var formattedString = StringBuilder() if (latitude.toDouble() < 0) { formattedString.append(String.format("%.2f", (latitude.toDouble() * – 1))) formattedString.append(0x00B0.toChar()) formattedString.append("S, ") } else { formattedString.append(String.format("%.2f", latitude.toDouble())) formattedString.append(0x00B0.toChar()) formattedString.append("N, ") } if (longitude.toDouble() ..

Read more

So this works fine: strFoo = "u20B9" + strBar But this doesn’t strFoo = R.string.rupee_symbol.toString() + strBar //.toString() is required //R.string.rupee_symbol.toString() evaluates to some random number 2131755148… which I believe is a character array… strings.xml <string name="rupee_symbol">u20B9 </string> I can’t figure out why it would behave like that, it looks like the same thing…! Source: ..

Read more

Starting from this method: weatherIconView.setIconResource(getString(R.string.wi_day_sunny)); I would like to use the iconID receiver from an API to call the specific string from the string.xml file: <string name="wi_00d"></string> Now, I cannot name the string starting with a number, and the API provides all the iconID’s starting with a number. So I tried concatenating "wi_" to the ..

Read more

Why is the field null here, and causing a NullPointerException? java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter $this$isBlank This is my Model class : data class ModelChatEntry( val id: String, val name: String? ): BaseModel, Parcelable { var nameInitials: String? = "" get() { if (field.isNullOrBlank()) { field = name?.let { nameStr-> ..

Read more