I am new to XML, and Android programming.I was following a tutorial, which asked me add new line in the display. Something like hello world. I did as it was instructed, changed main. xml, and put what i wanted to display in string.xml
It compiled fine, and It got displayed. but I go into string.xml/main.xml, try and compile, i get the error that is shown at the bottom. I couldn’t work this out, so i started all over again. And same cycle happens. If I just open either main.xml/string.xml, a second ot third time, it throws me all these error.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/some_name"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
strings.xml;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, ThisisannoyingActivity!</string>
<string name="app_name"> This is annoying</string>
<string name="some_name">w ha t ever</string>
</resources>
I have getting the following error;
res\layout\main.xml:0: error: Resource entry main is already defined.
res\layout\main.out.xml:0: Originally defined here.
thisisannoying\res\values\strings.out.xml:1: error: Error parsing XML: no element found
Could you please tell me what is going on here
Regards,
mike
Check inside of your res/layout folder in your project. There is a xml file there called.
. And in your res/values folder there is a file
delete both of these. If you are using MOTO DEV this is something that happens when you select a xml file and click build. Its weird.