android-resources

Android: getting Resources$NotFoundException for abc_ic_ab_back_material

坚强是说给别人听的谎言 提交于 2019-11-29 09:52:40
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") final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material); What

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

混江龙づ霸主 提交于 2019-11-29 09:19:41
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 } } Thing is, I don't know what to put there. I want the app name to be different (and yet have the

Toast.makeText from resource string

流过昼夜 提交于 2019-11-29 04:13:09
问题 I have a class named MyPrimaryClass, this class has a button witch when pressed, creates an Intent with the class myClassForResult. I use this to start it: startActivityForResult(myIntentOfMyClassForResult, ACTIVITY_EDIT_BTEXT); Both MyPrimaryClass, and myClassForResult extends Activity. So, when I call Toast.makeText within the myClassForResult, with the text parameter of R.string.my_resource_string, it gives me Force Close! I have tried this: Context c = myClassForResult.this; Toast toast =

issue in string array in xml file: Multiple substitutions specified in non-positional format and Found tag </item> where </string-array> is expected [duplicate]

試著忘記壹切 提交于 2019-11-29 02:52:00
Possible Duplicate: Android XML Percent Symbol hi mate i have an array in file xml: <string-array name="type_data_graph"> <item>Veichle speed (Km/h)</item> <item>Engine Rpm (rpm)</item> <item>Barometric pressure (kPa absolute)</item> <item>Fuel pressure (kPa)</item> <item>Fuel Rail pressure of manifold vacuum (kPa)</item> <item>Fuel Rail pressure diesel/gasoline (kPa)</item> <item>MAF air flow rate (grams/sec)</item> <item>Intake MAP (kPa)</item> <item>Engine % torque (%) </item> ...... </string-array> when commpile i get error on <item>Engine % torque (%) </item> the error is Description

XML within an Android string resource?

两盒软妹~` 提交于 2019-11-29 02:49:08
I was wondering if I could place XML within /res/values/strings.xml ? I ask this because I am checking for the XML data file for my application, if it does not exist yet then it creates it from the default contents that will be contained as a string resource. Eclipse tries to change the less than and greater than tags to their corresponding HTML entities when using the GUI to edit the strings. Is eclipse on the right track? Because I should think that it will be written out into my file as HTML entities too. Could I use getText() rather than getString() to convert the entities back into tags?

Reading a resource sound file into a Byte array

て烟熏妆下的殇ゞ 提交于 2019-11-29 02:26:02
I have cheerapp.wav or cheerapp.mp3 or some other format. InputStream in = context.getResources().openRawResource(R.raw.cheerapp); BufferedInputStream bis = new BufferedInputStream(in, 8000); // Create a DataInputStream to read the audio data from the saved file DataInputStream dis = new DataInputStream(bis); byte[] music = null; music = new byte[??]; int i = 0; // Read the file into the "music" array while (dis.available() > 0) { // dis.read(music[i]); // This assignment does not reverse the order music[i]=dis.readByte(); i++; } dis.close(); For the music byte array which takes the data from

Android Styles: Difference between 'style=“@android:style/XYZ”' and 'style=“?android:attr/XYZ”'?

孤街浪徒 提交于 2019-11-29 01:20:24
问题 I'm trying to style buttons to look like those I ask about in Android Full Width ICS style Minimalist Bottom ButtonsViews. I've succeeded, with the following xml for anyone interested: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:divider="@android:drawable/divider_horizontal_dark" android:gravity="bottom" android:orientation="vertical" android:paddingTop="16dip" android:showDividers="beginning|end" >

Ambiguous reference intellisense error from Resource.Designer.cs

回眸只為那壹抹淺笑 提交于 2019-11-28 23:15:28
I am running into a peculiar bug when developing on Visual Studio 2017 that I have been able to ignore for a while, but is now beginning to really bug me. I refer to this issue as a bug rather than an error because I am still able to build my projects in Visual Studio and deploy them to my development device without errors or warnings from the build output. This might seem alright to ignore for a bit, but over time it has become an issue because my intellisense is underlining it in red as an error every time I reference attributes from the Resource class. As you might guess, I refer this class

Android layout error: “Resource id <res_id> is not of type STYLE (instead attr)”

六月ゝ 毕业季﹏ 提交于 2019-11-28 22:44:01
I'm seeing an error I've never seen before w/ Android that's preventing some of my layout files from rendering in Eclipse. They render fine at runtime. The error that shows up in the graphical layout editor (and my Error log) is: "Resouce id 0x1010081 is not of type STYLE (instead attr)" I've searched for resource id 0x1010081 in my R files, and I can't find it so I'm guessing maybe somehow I have a conflict with a built in Android attr. I've also verified that all of my style attributes below point to actual styles and not attr. Any help appreciated. Here's my full layout code:

Disable Android resource / image / PNG optimization

左心房为你撑大大i 提交于 2019-11-28 20:29:27
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 process and the overall size is now 10% above the initial size , or 30% above my/PNGOUTWin optimized size.