android-resources

Xamarin Android Resource file not found

南楼画角 提交于 2019-11-29 17:19:39
问题 I am building an Android App in Visual Studio. When I try to build the app referencing items in the Resources folder, I get one of two errors. If I preface "Resource.Layout.[Id]" or "Resource.Id.[Id]" with the namespace for my project, I get this error: The type or namespace name 'Resource' does not exist in the namespace '[app namespace]' (are you missing an assembly reference?) If I don't preface the call to Resource with my namespace, it tries to access the default Android.Resource class

Use different resources for different application flavors using gradle

痞子三分冷 提交于 2019-11-29 17:05:05
问题 I have an android application and I would like to have different flavors. Specifically I would like to have 2 flavors and for each flavor use different strings (different strings.xml file) and maybe have some icons different. I have tried creating two folders in the project's root folder: flav1 and flav2 and used the following build.gradle android { compileSdkVersion "Google Inc.:Google APIs:15" buildToolsVersion "17.0.0" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs

How to add string in int? R.string.name+Integer.parse(myindex). not working

最后都变了- 提交于 2019-11-29 16:42:39
How to add string in int? R.string.name+Integer.parse(myindex). not working.Link txtt.setText(getString(R.string.("i" + j++))); not helpful. others found you can use getIdentifier() to retrieve the string's id, it returns a resource identifier for the given resource name. int stringId = getResources().getIdentifier("name"+myIndex, "string", getPackageName()); if (stringId > 0) { textView.setText(stringId); } if you are looking for a String array, the syntax is slightly different: int stringId = getResources().getIdentifier("name"+myIndex, "array", getPackageName()); String[] array =

Obfuscating resource strings that may give away too much information about programming logic

旧城冷巷雨未停 提交于 2019-11-29 15:50:06
问题 I currently use a combination of LVL and Proguard as a first line of defence against piracy. However, what about the resource strings? For example, if there is a resource string like "License check failed" then doesn't the pirate simply need to trace that resource id back to where it was used in the code? In fact, this is also true if the string is something generic like "Please contact dev". What is the best approach? 回答1: If you define a resource string, you will probably define or use it

Not Getting Thumb with Genres - Universal Music Player

邮差的信 提交于 2019-11-29 13:59:06
I am using UMP example provided by Google, I have not made any change in my code, even I have not tried anything out of the box, I just imported your project into my work-space and checked it on my device, and found that I am not getting Thumb with Genres (Songs by genre) and List of Genres... Whereas I supposed to get Thumb from our JSON, here is what I have tried (but no success) - holder.mImageView.setImageBitmap(description.getIconBitmap()); UPDATE # 1 AS PER SUGGESTED BY @NageshSusarla here holder.mTitleView.setText(description.getTitle()); holder.mDescriptionView.setText(description

Output: error: resource style/TextAppearance.Compat.Notification.Info (aka package_name:style/TextAppearance.Compat.Notification.Info) not found

前提是你 提交于 2019-11-29 13:34:53
After switching to Android Studio 3.2 canary I am getting the following build error. I have seen this post where the guy had a similar issue but no solution was mentioned over their. I want to try new material components and jetpack so is there any possibility where I don't have to switch back. com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed Output: error: resource style/TextAppearance.Compat.Notification.Info (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Info) not found. error: resource style/TextAppearance.Compat

WARN in logcat ResourceType: For resource …, entry index(…) is beyond type entryCount(1)

梦想与她 提交于 2019-11-29 13:17:29
问题 I am getting these warnings on logcat every time the app renders some layout. Tried to search about but could not find a clue. I think is something related with resources (drawables, strings or values) but I don't know what is causing this. It's not an error, but is a little annoying. Somebody have an idea? 04-22 15:28:33.204 21943-21943/xx.xxx.xxxxxxx.xxxxx.xxxxx W/ResourceType﹕ For resource 0x01030128, entry index(296) is beyond type entryCount(1) 04-22 15:28:33.204 21943-21943/xx.xxx

How to get String Resource within ViewPager Adapter?

那年仲夏 提交于 2019-11-29 12:56:08
问题 I trying to set the title for my viewpager, I can't seem to get it to work. I tried Resources.getSystem().getString(R.string.title1); and also tried to pass a context. Could anyone help me? public class ViewPagerAdapter extends FragmentPagerAdapter { final int PAGE_COUNT = 3; Context context; public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return PAGE_COUNT; } @Override public Fragment getItem(int position) { return PageFragment.create(position + 1

How can I convert the android resources int to a string. eg.: android.R.string.cancel?

三世轮回 提交于 2019-11-29 10:56:54
问题 How can I obtain the string value "cancel" from this resource int: android.R.string.cancel ? thank you 回答1: Simply use Context#getString(): String string = getString(android.R.string.cancel); I've already tried this approach but with no success... I've a class: public class MyDialogFragment extends DialogFragment { A DialogFragment is not a subclass of Context, so you need to get access to a valid one (like your Activity's). Use this: String string = getActivity().getString(android.R.string

How does one use Resources.getFraction()?

依然范特西╮ 提交于 2019-11-29 10:50:42
问题 How do I store a fractional value like 3.1416 in resources? What to write in the XML and how to retrieve it in Java code? The documentation for getFraction() states: public float getFraction (int id, int base, int pbase) Retrieve a fractional unit for a particular resource ID. Parameters base The base value of this fraction. In other words, a standard fraction is multiplied by this value. pbase The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by