Issue I need to pass a resource ID to a method in one of my classes. It needs to use both the id that the reference points to and also it needs the string. How should I best achieve this?
Continue readingTag: resources
WebView, add local .CSS file to an HTML page?
Issue In android I’m using WebView to display a part of a webpage which I fetched from the internet using HttpClient from Apache. To only have the part I want from the html, I use Jsoup. String htmlString = EntityUtils.toString(entity4);
Continue readingAndroid and Kotlin varargs: formatted strings returns garbage
Issue I’m encountering a strange problem: I’ve a general function which is used to retrieve resource strings (it’s just to avoid writing context.resources.getString() everytime): protected fun string(@StringRes stringRes: Int, vararg args: String): String = app.getString(stringRes, args) worked fine up until
Continue readingLocalization and drawables
Issue I want to localize an image by adding the folder res/drawable-hdpi-no, but I get an error stating “invalid resource directory name”. What’s up with this? Solution As far as I remember, only certain res folders will work. You need
Continue readingHow to get access to raw resources that I put in res folder?
Issue In J2ME, I’ve do this like that: getClass().getResourceAsStream(“/raw_resources.dat”); But in android, I always get null on this, why? Solution InputStream raw = context.getAssets().open(“filename.ext”); Reader is = new BufferedReader(new InputStreamReader(raw, “UTF8”)); Answered By – Adrian Vintu Answer Checked By –
Continue readingIs it possible to get resources inside a static context block?
Issue I want to create a static Hash table to convert strings to integers. The caveat here is that I want to use strings I defined as resources in several lists in XML files. I am able to write this,
Continue readingGetting android.content.res.Resources$NotFoundException: exception even when the resource is present in android
Issue Please let me know where I am going wrong to get the error. I am creating an app which have one of its activity to be only in landscape mode. So I added the following in AndroidManifest.xml file <activity
Continue readingEquivalent to R in iOS
Issue In android we have the R class that stands for Resources, where we have references to all of our resources and we can easily access them in the code. Is there an equivalent in iOS? I have this doubt
Continue readingAndroid: How do I get string from resources using its name?
Issue I would like to have 2 languages for the UI and separate string values for them in my resource file res\values\strings.xml: <string name=”tab_Books_en”>Books</string> <string name=”tab_Quotes_en”>Quotes</string> <string name=”tab_Questions_en”>Questions</string> <string name=”tab_Notes_en”>Notes</string> <string name=”tab_Bookmarks_en”>Bookmarks</string> <string name=”tab_Books_ru”>Книги</string> <string name=”tab_Quotes_ru”>Цитаты</string> <string name=”tab_Questions_ru”>Вопросы</string> <string name=”tab_Notes_ru”>Заметки</string>
Continue readingWhy do I get a Resources$NotFoundException when using InstrumentationRegistry.getContext().getString()?
Issue I am running Android Instrumentation tests and when I use the Context returned by InstrumentationRegistry.getContext() to retrieve a string given an id I get the message: android.content.res.Resources$NotFoundException: String resource ID #0x7f060020 I’ve tried ids from other string resources but
Continue reading