I know this is a very common problem and I read the previous posts
But my project was just working fine and after I added a radio button it ruined the interface
Then I deleted the radio button and some interface contents (like edit-texts and button) and added them again. Now the interface is fine.
The MainActivity.java did not recognize the radio button (although import android.widget.RadioGroup; import android.widget.RadioButton; are there) so I cleaned the project because I wanted R.java to be updated Then, R.java DISAPPEARS and the console shows this image
Things I have tried :
Re-clean project
Fix project portieres
This is my main_activity.xml
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
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.reg.MainActivity" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="14dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RadioButton
android:id="@+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RadioGroup>
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText1"
android:layout_below="@+id/radioGroup1"
android:layout_marginTop="24dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textEmailAddress" >
</EditText>
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/editText4"
android:layout_alignLeft="@+id/editText2"
android:layout_marginBottom="18dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword" />
<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText4"
android:layout_below="@+id/editText4"
android:layout_marginTop="25dp"
android:ems="10"
android:inputType="date" />
<EditText
android:id="@+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText5"
android:layout_below="@+id/editText5"
android:layout_marginTop="20dp"
android:ems="10"
android:inputType="textEmailAddress"/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="28dp"
/>
</RelativeLayout>
please justify your answer, I am just a beginner
UPDATE
it works when I change the target to 21 but I want it to be 20