I am getting an error saying String types not allowed (at 'id' with value ' @id/bAdd')
Everything was working earlier, I don't what happened, causing this error.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Your total is 0"
android:textSize="45dp"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/tvDisplay"
tools:context=".StartingPoint" />
<Button
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Subtract One"
android:layout_gravity="center"
android:textSize="20dp"
android:id="+@id/bSub"
/>
<Button
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Add One"
android:layout_gravity="center"
android:textSize="20dp"
android:id="+@id/bAdd"
/>
You can give your id as @+id/bAdd
instead of +@id/bAdd
Also edit in
android:id="@+id/bSub"
^^
instead of
android:id="+@id/bSub"
^^
+ Symbol must be after @ Symbol.
android:id="+@id/bAdd" to android:id="@+id/bAdd"
and also change
android:id="+@id/bSub" to android:id="@+id/bSub"
OR
you can declare is it
android:id="@id/bSub"
but you have to declare bSub value in ids.xml file located in values folder.
<resources>
<item type="id" name="bSub" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With