android-resources

How to disable the preview of xml reference values in Android Studio settings/configuration?

老子叫甜甜 提交于 2019-12-03 18:09:53
问题 I'm not sure if my question is worded correctly, but it's easier to show an image to explain my question. In the XML editor, some values are replaced with the actual values that was defined for that entry. However, I don't want Android Studio showing me the actual values. Instead, I still prefer that it showed the reference names. So, how do you disable the editor from previewing in this manner? In the image below, android:text="@string/sign_up" , but the editor is showing it as android:text=

“No resource found” errors when building app

女生的网名这么多〃 提交于 2019-12-03 13:52:38
I'd like to migrate my Eclipse project to Android Studio. I used to build the project with minSdkVersion=8, but I want to add new functionality that requires minSdkVersion 10. I'm running Android Studio 1.1.0. After importing the Eclipse project ("Import project" on the main AS screen), I go to the "Project Structure" window, select the "Flavors" tab, and specify API 10 (Gingerbread) for min sdk and target sdk. When I rebuild the project, I get over 100 errors in the console that look like this: Information:Gradle tasks [clean, :jellyWatch:compileDebugSources] :jellyWatch:clean :jellyWatch

Resources$NotFoundException drawable-xhdpi from drawable resource

陌路散爱 提交于 2019-12-03 13:43:27
I was checking my bug reports and from time to time we get this bug report from our app. I can't pint point what is the actual problem. This resource does exist, most of devices work fine but some specific devices like LG-E510 or U8815 just cant load this resource. Any ideas? android.content.res.Resources$NotFoundException: File res/drawable-xhdpi/action_bar_search_icon.png from drawable resource ID #0x7f02007f at android.content.res.Resources.loadDrawable(Resources.java:1714) at android.content.res.Resources.getDrawable(Resources.java:581) at com.actionbarsherlock.internal.view.menu

What is “android:” prefix mean in android framework-res module

江枫思渺然 提交于 2019-12-03 13:34:54
问题 I copy the this code from the styles.xml file in framework-res module <style name="Theme"> <item name="colorForeground">@android:color/bright_foreground_dark</item> <item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item> <item name="colorBackground">@android:color/background_dark</item> . <style name="Theme.Black"> <item name="android:windowBackground">@android:color/black</item> <item name="android:colorBackground">@android:color/black</item> </style> As you

Android resource not found because of width and height

岁酱吖の 提交于 2019-12-03 13:19:09
问题 I've published an Android app in the store recently that worked perfectly for almost all of my users. However, I shortly started getting a few crash reports a week with the following trace: Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xhdpi/dark_button_unpressed.png from drawable resource ID #0x7f02005d at android.content.res.Resources.loadDrawable(Resources.java:1716) at android.content.res.Resources.getDrawable(Resources.java:581) at android.graphics

Set Notification Sound from Assets folder

一曲冷凌霜 提交于 2019-12-03 09:43:28
I am attaching the sound files in the assets folder for play sound in the notification but I am not able to play sound from the assets folder. I have setting page from which user can set the sound for the notification and also user can play sound. This part is completed. I am able to play sound from the assets folder using Media Player. I can use same logic at the Notification creation time but problem can be happened when user click on the Notification because media player still playing the sound. I tried notification.sound = Uri.parse("file:///android_asset/Sound/Long/AlarmClock.mp3"); also

Format string XXX is not a valid format string so it should not be passed to String.format

半世苍凉 提交于 2019-12-03 09:40:40
I have android app and this string in resources: <string name="create_group_select_people">Select up to %1$d people!</string> This is called from fragment: Integer countMax = 5; //also tried just "int" - nothing changed getResources().getString(R.string.create_group_select_people, countMax); but I got error: Format string 'create_group_select_people' is not a valid format string so it should not be passed to String.format I can't understand what is wrong? When I launch app - it shows me literally "Select up to %1$d people!" ohdroid I just copied the code and it works well. so you may need to

How to use Android quantity strings (plurals)?

自闭症网瘾萝莉.ら 提交于 2019-12-03 09:40:24
I am trying to use getQuantityString method in Resources to retrieve Quantity Strings (Plurals) based on android developer guidelines Quantity String (Plurals) The error I am getting is Error:(604) Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? Error:(604) Found tag </item> where </plurals> is expected when I set up plurals as below <plurals name="productCount"> <item quantity="one" formatted="true">%1$d of %2$d product</item> <item quantity="other" formatted="true">%1$d of %2$d products</item> </plurals> and trying to read it as

How to remove unused resources from libraries?

假如想象 提交于 2019-12-03 08:40:53
At first I know Remove all unused resources from an android project , but that is only for projects. I want to remove unused images from a library like the Google Play Services or the Wearable SDK. I already know that I can remove unwanted languages in gradle by using resConfigs , but I don't know how to remove images and layouts which I don't use. Is there any way to avoid that they are added? I almost missed it to write that there is now a nice solution: android { buildTypes { release { minifyEnabled true shrinkResources true } } } This was annouced on Google+ by Tor Norbye for the build

Best way to store Resource id in Database on Android

﹥>﹥吖頭↗ 提交于 2019-12-03 08:37:06
In my app i want to be able to store resource id of some icons in database. I suppose it is not save to do, cause in the later stages (application upgrades) i may want to add new icons to the app, so all id's may change? What is the best practice to store resource in case i do not want to store icons as blobs? As an example, let's say i have a game 1.0, where i let user to choose an avatar for his character from a list of avatars. I want to store this avatars id in DB and be sure that if i add more avatars in game 1.1 - user will still see his choice. The best way (in my opinion) is to store