android-resources

Android res/layout Folder not included in the APK file (but included in the ANE)

拟墨画扇 提交于 2020-01-16 19:57:07
问题 I'm having a problem with resources on an Adobe ANE Android extension: android.content.res.Resources@NotFoundException: id.myView I have a xml layout file, which is included in the ANE file (checking by unzipping the ANE file and looking into META-INF/ANE/Android-ARM ) In the APK file (generated with Flash Builder 4.6), the layout folder (inside res ) at the top level is missing, but it's included deep in the assets folder: - META-INF - res drawable drawable-hdpi drawable-ldpi drawable-mdpi

Integer resource not what expected

扶醉桌前 提交于 2020-01-16 18:14:23
问题 I have the following integer resources in my strings.xml file <item type="integer" name="pID" format="integer">374</item> <item type="integer" name="vID" format="integer">3468</item> I want to call them from my code to get 374 and 3468. However, when I output to Logcat... Log.d("MainActivity.onCreate","pID: "+R.integer.pID+" vID: "+R.integer.vID); I see the following... pID: 2131230720 vID: 2131230721 Why are R.integer.vID and R.integer.pID returning ints other than 3468 and 374 respectivley?

W/ResourceType(463): Failure getting entry in package 0 (error -75) in Android Activity

人盡茶涼 提交于 2020-01-14 07:56:11
问题 In one Activity (it's a SherlockActivity , by the way) of my Android application, I have a normal ListView . For that ListView , I set an AdapterView.OnItemClickListener via getListView().setOnItemClickListener(...) . And in that listener, an AlertDialog is built using the AlertDialog.Builder class and then it is shown to the user: getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, final View v, int position, long id) {

getQuantityString returns wrong string with 0 value

荒凉一梦 提交于 2020-01-14 07:26:24
问题 In an android app, I have the following string resources: <plurals name="test"> <item quantity="zero">"I have 0 item"</item> <item quantity="one">"I have 1 item"</item> <item quantity="other">"I have several items"</item> </plurals> And the following line of code: String text = getResources().getQuantityString(R.plurals.test, 0) which I would expect to return I have 0 item But it actually returns I have 1 item Why ? 回答1: Quantity Strings are broken on some Plattforms and phones as the issue

Use the smallest width qualifier -Android

怎甘沉沦 提交于 2020-01-14 06:44:09
问题 Android documentation Use the Smallest-width Qualifier states: res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger) 600dp: a 7” tablet (600x1024 mdpi). 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc) meaning that screen widths with 660dp and higher are tablets like. But a phone with lets say only 5.5 inches and 1440x2960 570dpi doesnt mean that it is a tablet. So how can you distinguish that difference? Thanks 回答1: But a phone with lets say only 5.5 inches and

color string resource for xml layout

自闭症网瘾萝莉.ら 提交于 2020-01-14 05:32:14
问题 <string name="some_text">this is <font fgcolor="#ffff0000">red</font></string> or <string name="some_text">this is <font color="#ffff0000">red</font></string> is not doing it. I need to call the string in an xml TextView. How do I get it to work? No I don't want to use a horizontal LinearLayout with a bunch of TextViews. 回答1: You can't do this. instead of you can set TextView text as HTML like textview.setText(Html.fromHtml("this is<font color=\"##ffff0000\">red</font>")); Go to this for more

Reference drawable from string-array in android [duplicate]

若如初见. 提交于 2020-01-12 02:19:29
问题 This question already has answers here : Storing R.drawable IDs in XML array (6 answers) Closed 5 years ago . how would I reference a drawable resource from the string xml file? I want to do <string-array name="my_array"> <item>@drawable/my_image</item> ... How would I do that? 回答1: for arrays of drawables ids, don't use string array just use <array> then to use them, get a TypedArray if the ids TypedArray images = getResources().obtainTypedArray(R.array.my_image_ids); int resourceId = images

How to open a PDF file from res/raw Folder?

我的未来我决定 提交于 2020-01-11 09:50:43
问题 I am writing an application that opens a pdf file when you click a button. Below is my code: File pdfFile = new File( "android.resource://com.dave.pdfviewer/" + R.raw.userguide); Uri path = Uri.fromFile(pdfFile); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setDataAndType(path, "application/pdf"); startActivity(intent); However when I run it and press the button it says "The document cannot be opened because its is not a valid PDF

How to fix “No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')”

烂漫一生 提交于 2020-01-09 11:39:46
问题 I am getting the following error when I build my Android App project in Visual studio 2015. No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') These lines are located under: obj\Debug\android\manifest\AndroidManifest.xml There is 3 entires of it inside the AndroidManifest file . I have downloaded the google play service from the SDK Manager . Should I reference anything to my solution? I already has Xamarin.GooglePlayServices.Base,

ListView whose id attribute is 'android.R.id.list' Error when I have the ListView id set correctly

前提是你 提交于 2020-01-09 10:01:51
问题 I have a Listview with a custom adapter. I am getting the standard Your content must have a ListView whose id attribute is 'android.R.id.list' error, however, My ListView has an android:id="@android:id/list" value set. It's really doing my head in. Any suggestions? main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Layout"> <ListView android:id="@android:id/list" style="@stlye/ListMenuView"></ListView> <