android-resources

How to delete an unused string resource for all configurations in Android Studio?

邮差的信 提交于 2019-12-17 18:25:49
问题 I've found an unused string resource, like: <string name="obsoletestring">my name is null!</string> However it is in tens of files, of different languages, in different strings.xml files in values , values-af , values-be , etc folders. I must have missed something not to know any way to do this in Android Studio other than modifying it by hand one by one. tl;dr How to delete an unused string resource for all configurations? 回答1: It is now possible inside Android Studio. After Lint checks you

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

廉价感情. 提交于 2019-12-17 15:53:29
问题 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

Failed linking file resources

孤人 提交于 2019-12-17 15:38:18
问题 This is the java file that is giving the error package com.example.daksh.timetable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button mon_but,tue_but,wed_but,thur_but,fri_but;

Will a density qualified drawable folder or drawable-nodpi take precedence?

自闭症网瘾萝莉.ら 提交于 2019-12-17 15:32:16
问题 If I define drawables for a density qualified folder (eg drawable-hdpi), and also drawables to fall back on in drawable-nodpi , will a high density device use the -hdpi over the -nodpi ? What about if I take it a step further and also have the same setup for -land folders. 回答1: I'm not sure what the precedence is for nodpi , but that should never be a problem. It sounds like you are misunderstanding the nodpi qualifier. You should not use nodpi as a fallback for assets that you don't provide

Android - How to regenerate R class? [duplicate]

百般思念 提交于 2019-12-17 15:24:45
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Developing for Android in Eclipse: R.java not generating I have imported a project into my Eclipse IDE, but it's giving me an error since R file is not generated automatically. How can I edit the R file so that it matches my project requirements? 回答1: In another stackoverflow question, somebody answered this : you must get rid of warnings and errors (syntax and links) in your xml files. This plus doing a clean /

List Adapter setting - How can I not to repeat the list item layout resource?

霸气de小男生 提交于 2019-12-17 15:04:14
问题 I have made a ListView with an ArrayAdapter. It works. But I had to put the resource id for the item layout twice: in the adapter definition and in the getView, in the case when the View parameter is null. // --------------------------------------------here is the FIRST use lvShows.setAdapter(new ArrayAdapter<TvShow>(this, R.layout.show_row, allKnownShows) { @Override public View getView(int position, final View rowView, ViewGroup parent) { LinearLayout showView; if (rowView == null) { // ---

Sub folders in drawable resource folder? [duplicate]

邮差的信 提交于 2019-12-17 12:05:10
问题 This question already has answers here : Can the Android drawable directory contain subdirectories? (20 answers) How to access res/drawable/“folder” (5 answers) Closed 5 years ago . I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that? Thanks. 回答1: This is now (sort of) possible by using Android Studio and Gradle. Whilst subfolders are

Sub folders in drawable resource folder? [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-17 12:04:42
问题 This question already has answers here : Can the Android drawable directory contain subdirectories? (20 answers) How to access res/drawable/“folder” (5 answers) Closed 5 years ago . I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that? Thanks. 回答1: This is now (sort of) possible by using Android Studio and Gradle. Whilst subfolders are

Getting resources of another Application

和自甴很熟 提交于 2019-12-17 10:55:40
问题 Assume I've got 2 Application A and B. I want to access resources (drawables, images, strings) of an B application from A application. How would I do that? Edit: You can also designate an Android project as a library project, which allows it to be shared with other projects that depend on it. Once an Android project is designated as a library project, it cannot be installed onto a device. Does it mean That I can not use my library on android market? My aim is to use default resources of

Android Studio: Creating landscape layouts

点点圈 提交于 2019-12-17 06:35:09
问题 Until recently I used Eclipse, and in Eclipse I simply created a folder /res/layout-landscape and put alternate landscape layouts inside. However, it seem in Android Studio 1.1.0, I can't do it that way. How do I create the folder for alternate landscape layouts? 回答1: You can actually use layout-land in Android Studio as well it will show up in your res directory like so: If it doesn't show up make sure to have your project scope set to Project and not Android . If you still don't see one you