0
public static final class id {
        public static int Phone Number=0x7f050043;

error shows in a above link Phone Number=0x7f050043. 

What could be the problem? I have already changed the XML id from @+id/Phone Number to @+id/phoneNumber.

I've done many things related with this like clean the project, delete gen folder, but the error persists. My project submission is tomorrow. Please help me find a Solution.

my XML file is

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.pgfinder.Add_PG" >

    <RelativeLayout
        android:layout_width="400dp"
        android:layout_height="470dp"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" >

        <EditText
            android:id="@+id/gender"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/house"
            android:layout_below="@+id/house"
            android:layout_marginTop="20dp"
            android:ems="10"
            android:gravity="center"
            android:hint="Pg For Male or Female" />

        <EditText
            android:id="@+id/landmark"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/city"
            android:layout_below="@+id/city"
            android:layout_marginTop="17dp"
            android:ems="10"
            android:gravity="center"
            android:hint="Landmark" />

        <EditText
            android:id="@+id/phone_number"
             android:gravity="center"
             android:hint="Phone Number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/landmark"
            android:layout_below="@+id/landmark"
            android:layout_marginTop="23dp"
            android:ems="10" />

        <EditText
            android:id="@+id/house"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="15dp"
            android:ems="10"
            android:gravity="center"
            android:hint="House Address" />

        <EditText
            android:id="@+id/meal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/gender"
            android:layout_below="@+id/gender"
            android:layout_marginTop="25dp"
            android:ems="10"
            android:gravity="center"
            android:hint="Pg With Meal or Not" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/city"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/meal"
            android:layout_below="@+id/meal"
            android:layout_marginTop="14dp"
            android:ems="10"
            android:gravity="center"
            android:hint="City" />

        <Button
            android:id="@+id/add_pg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/Phone Number"
            android:layout_below="@+id/Phone Number"
            android:layout_marginTop="24dp"
            android:text="Add New PG" />

        <Button
            android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/add_pg"
            android:layout_alignBottom="@+id/add_pg"
            android:layout_alignRight="@+id/Phone Number"
            android:text="Cancel" />

    </RelativeLayout>

</RelativeLayout>
user3133809
  • 9
  • 1
  • 4

3 Answers3

0

Step 1: Delete build folder from project, and recompile your code. Recompilation will recreate build folder (and R file). It will solve the issue.

Step 2: If above step doesn't work rename id i.e. @+id/phoneNumber to @+id/phoneNumber1 and perform step 1 again.

Update

Replace each instance of Phone Number with phone_number like in android:layout_below="@+id/Phone Number" or android:layout_alignLeft="@+id/Phone Number". Do it in both buttons i.e. add_pg and back.

See:

 <Button
            android:id="@+id/add_pg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/Phone Number"
            android:layout_below="@+id/Phone Number"
            android:layout_marginTop="24dp"
            android:text="Add New PG" />

Replace it with :

 <Button
            android:id="@+id/add_pg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/phone_number"
            android:layout_below="@+id/phone_number"
            android:layout_marginTop="24dp"
            android:text="Add New PG" />
0

rename into @+id/phoneNumber save Ctrl s

try manual allocating by yourself in R.java public static int phoneNumber=0x7f050050; save ctrl s

Binod Rokka
  • 869
  • 1
  • 5
  • 5
0

Same thing happen to me , and i passed a day to fix this. really this is a stupid error. i am just shearing my experience, may be it would helpful to you . First look carefully when you type this setContentView(R.layout.activity_to_do_list); hear your starting point R.l then eclipse should open a suggestion for you look like this enter image description here

you import the second one not layout-android.R . the second one is created in your project hear com.example.gridtest is the project package name . then focus your imported section in your code enter image description here

ok look this import com.example.gridtest.R; its important . If you already import this android.R then remove it. Thank you hope it works . ( you don't need to do this always but if you face this kinda problem then do this ) There are more option you can try this click

Community
  • 1
  • 1
Tanim reja
  • 2,120
  • 1
  • 16
  • 23