Android eclipse resource strings error - android

When I make a new android project and I go to res/values/string.xml I get a screen to add android resources instead of a XML document. I keeps getting the error about : java.lang.NullPointerException.
Is there a way to just alter a XML file (like suggested in tutorials)?

You have a small tab bar on the bottom in eclipse, where you can switch between the GUI and the plain XML file (only visible if you have already opened the file)

do you create a new xml with java or the Android xml file ? because with java it's not gonna work .

Related

Can't see Android graphical layout

I have started a new Android empty project.
Where can i find the graphical layout switch button ?
I have Eclipse Java EE and didn't installed any ADT plug-ins
because i am guessing they are already installed.
Do i need to put initial code before i'll be able to use it?
i read that i need to open the XML file to use the graphical layout,
the only xml file that i found is the manifest.
and accessing this file didn't get any result.
thanks,
Rami
You will find the layout xml files in /res/layout/*.xml.
These are the files that when opened will have a graphical editor.
If there aren't any then you can make one by using the new XML wizard.

eclipse Android Xml file design view

my Android xml fle Design look like this.
but i want to view like this so how can do this?
Right click on xml and select open with -> Android XML Resources Editor and also
you can try open with -> Android Layout Editor to have Design Layout tab.
I also faced this problem earlier for all xml files but not for manifest file ,now it resolved
in my application our requirement is When the orientation of the activity changes place the appropriate land folder and xml files.in that we give wrong naming conventions for the layout folders instead of layout-land,layout-land-hdpi,layout-land-mdpi,layout-land-ldpi,layout-port,layout-port-hdpi,layout-port-mdpi,layout-port-ldpi when ever we correct the naming conventions it comes normally.

setContentView problem

I am beginner in android so some beginer problems is occured. I create second activiy and second layout xml file named getNearest.xml. The code section to show this file is
setContentView(R.layout.getNearest)
But eclipse cannot be find getNearest. It only shows .main. So what is the problem with this?
You need to build at least once to have the R.layout values updated when you create a new layout. Also make sure you saved the layout file and that it exists under the res\layout folder.

Problem with creating XML drawable

I’m trying to create a roll over affect for my ImageButtons in my application I’ve been following the guide on the android developer’s site here’s the link
I’ve been trying to create the required XML drawable file which will change the image if it’s clicked but I’m unsure what type of xml file to create, whether it be animation, layout, value etc. When I go to create the file it forces you to select the type of file which stops you creating the xml in the drawable folder.
Does anyone know what typesof xml file I need to create?
In that case just don't select Android XML File in that list. Select Other and in the following list select XML File from the XML section. Give it an appropriate name and then just define what you need to define.

Unable to add Preferences.xml (Android Preferences in XML)

Hopefully, this is a newbie question with a quick answer...
I am attempting to add a simple preferences file in a new Android project (New -> Android XML File), but it doesn't appear to be working correctly.
There is no root element to choose from when I select the Preference type layout. If I press Finish, it doesn't do anything. See screenshot below.
Thanks,
wTs
Just create a normal xml file to the project /res/xml/ folder and add your content to the file as usual. Should work just great. Eclipse detects it as a preference file once you have added the preference-xml and saved it.
You don't need to have a root element in the selection screen. Just replace whatever eclipse generates with what you want.
try refreshing the folder that the file is supposed to be in (in your example res/xml).

Categories

Resources