android-resources

Android: getting Resources$NotFoundException for abc_ic_ab_back_material

一个人想着一个人 提交于 2019-11-28 03:18:07
问题 I'm getting a Resources$notfoundexception on older (pre-L) devices. I'm including the full stacktrace below. My version of the support library is the latest (24.1.0), and I've included in my gradle file the line: vectorDrawables.useSupportLibrary = true My base theme is a noactionbar theme - "Theme.AppCompat.Light.NoActionBar" The crash is happening on this line in my code where I reference the back arrow in a support-toolbar in order to later change it's color: @SuppressLint("PrivateResource

How to use build types (debug vs release) to set different styles and app names?

丶灬走出姿态 提交于 2019-11-28 02:42:03
问题 Background On Android Studio, you can have different build types, each has its own configuration, similar to product-flavors (as shown here) The problem I wish that each time I have my app installed somewhere, I would immediatly know which type it was - release or debug, just by looking at it. For this, I think I can use the build.gradle file : buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable true

Why does BitmapFactory.decodeResource scale my image?

那年仲夏 提交于 2019-11-28 01:27:02
I have an image that is 120x120px located in my /res/drawable/ directory. This is the size required for all devices. To load this Bitmap, I am using the following: Bitmap tmpBmp = BitmapFactory.decodeResource(getResources(), R.drawable.myimage); The issue is that when I measure tmpBmp , the size is 360x360px. I know how to scale this back down to the 120x120 that I need, but it is a waste of processing time, although minimal. I am assuming that this has something to do with screen densities, since my resource is in a density-less directory. What is the reason for decodeResource scaling my

Using Locale to force Android to use a specific strings.xml file for a non-supported language

﹥>﹥吖頭↗ 提交于 2019-11-27 22:58:45
...and if so, how? We make a dedicated Android device for use in an industrial environment. It's basically a tablet, but with only one app running. The user is not expected to access any other features of the device and even the system settings, like WiFi and Time settings are performed through our app instead of through the Android Settings widget. So basically every button and message they see uses our strings.xml file . Currently all of our customers are satisfied to use the default US-English settings but we will soon have some customers who want local languages and have supplied us with

Plural definition is ignored for zero quantity

梦想与她 提交于 2019-11-27 22:42:01
I use plurals to compile a quantity string for an Android application. I follow exactly what one can find in the tutorials: res.getQuantityString( R.plurals.number_of_comments, commentsCount, commentsCount); Here is the definition of the plurals: <?xml version="1.0" encoding="utf-8"?> <resources> <plurals name="number_of_comments"> <item quantity="zero">No comments</item> <item quantity="one">One comment</item> <item quantity="other">%d comments</item> </plurals> </resources> Interesting enough, the output string is odd to what I definied: commentsCount = 0 => "0 comments" commentsCount = 1 =>

Execution failed for task ':app:processDebugResources' even with latest build tools

£可爱£侵袭症+ 提交于 2019-11-27 22:10:12
I am getting this error when I try to run my project. I have installed the latest build tools- 23.0.3 but still the error persists. How do I fix this? Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources] Configuration on demand is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE :app:prepareComAndroidSupportDesign2321Library UP-TO-DATE :app

Android method with default (package) visibility overriding (shouldn't work, but does - why?)

十年热恋 提交于 2019-11-27 21:40:00
I've been playing around with SVG support in Android and came up with this library which claims that it supports SVG just as it they were native. Since I took great pains in discovering that this is not really possible, I went to see how this dude actually managed it. So I came upon his Resources derivative in which he declares a method ( loadDrawable ) that has default visibility in base Resources class. The funny thing is, normally lint would just report that you can't write this method since it would hide base method, but in this particular case (note the absense of @Override directive )

multilanguage app: best way? [closed]

拈花ヽ惹草 提交于 2019-11-27 21:00:20
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Which is the best way to have a multilanguage app? Should I create a set of strings written in my language and then use an google api

Disable Android resource / image / PNG optimization

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 20:43:11
问题 How do I prevent the Android "build process" from optimizing .png images? I have an Android project with the following res directories: - /res/ - /res/drawable - /res/drawable-hdpi - /res/drawable-hdpi-v5 - /res/drawable-ldpi - /res/drawable-ldpi-v5 - /res/drawable-mdpi - /res/drawable-mdpi-v5 These directories contain many .png files . I optimize PNG sizes with PNGOUTWin, and the overall size is reduced by more than 20%. When I build the .apk file, the images are "optimized" by the build

Android: How to get string in specific locale WITHOUT changing the current locale

佐手、 提交于 2019-11-27 20:25:06
Use Case: Logging error messages as displayed to the user. However you don't want to have messages in your log that depend on the locale of the user's device. On the other hand you don't want to change the locale of the user's device just for your (technical) logging. Can this be achieved? I found a couple of potential solutions here on stackoverflow: how to get string from different locales in Android? Can I access to resources from different locale android? android - Get string from default locale using string in specific locale maybe even android - Changing Locale within the app itself