Android: Cannot be resolved or is not a field , possible help required -


this class

package com.example.payrollapplication.details;   import com.example.payrollapplication.r;  import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext;  public class addemployee extends activity implements onclicklistener{  edittext e_name, e_designation, e_phone, e_age, e_basic, e_ot, e_pf, e_otheralloances;  button b_save, b_cancel , b_reset;  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.employee_entry);       e_name = (edittext)findviewbyid(r.id.enameedit);     e_designation = (edittext)findviewbyid(r.id.edesignationedit);     e_phone = (edittext)findviewbyid(r.id.enumberedit);     e_age = (edittext)findviewbyid(r.id.eageedit);     e_basic = (edittext)findviewbyid(r.id.ebasicpayedit);     e_ot = (edittext)findviewbyid(r.id.eovertimeedit);     e_pf = (edittext)findviewbyid(r.id.epfedit);     e_otheralloances = (edittext)findviewbyid(r.id.eotheralloanceedit);       b_save=(button)findviewbyid(r.id.savebutton);     b_cancel=(button)findviewbyid(r.id.cancelbutton);     b_reset=(button)findviewbyid(r.id.resetbutton);       b_save.setonclicklistener(this);         b_cancel.setonclicklistener(this);     b_reset.setonclicklistener(this);  }  @override public void onclick(view v) {     // todo auto-generated method stub     switch(v.getid()) {      case r.id.b_save:           break;      case r.id.b_cancel:           break;      case r.id.b_reset:           break;        } } 

}

and xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@drawable/background" android:gravity="top" >    <textview     android:id="@+id/tv"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_margintop="20sp"     android:gravity="center_horizontal"     android:text="employee entry details"     android:textcolor="#000000"     android:textsize="35sp"     android:textstyle="italic" />  <linearlayout     android:id="@+id/linearlayout1"     android:layout_width="fill_parent"     android:layout_height="750sp"     android:layout_alignparentleft="true"     android:layout_alignparentright="true"     android:layout_below="@+id/tv"     android:layout_margintop="10dp"     android:orientation="vertical" >      <tablerow         android:id="@+id/tablerow1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="50sp">          <textview             android:id="@+id/enametext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee name:"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp" />          <edittext             android:id="@+id/enameedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>      <tablerow         android:id="@+id/tablerow2"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/edesignationtext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee designation:"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/edesignationedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>      <tablerow         android:id="@+id/tablerow3"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/enumbertext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee phone number:"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/enumberedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10" >              <requestfocus />         </edittext>      </tablerow>      <tablerow         android:id="@+id/tablerow4"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/eagetext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee age :"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/eageedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>      <tablerow         android:id="@+id/tablerow5"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/ebasicpaytext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee basic pay :"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/ebasicpayedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>      <tablerow         android:id="@+id/tablerow6"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/eovertimetext"             android:layout_width="250sp"             android:layout_height="wrap_content"             android:text="employee on time :"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/eovertimeedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>      <tablerow         android:id="@+id/tablerow6"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/epftext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee pf deduction :"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/epfedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow>       <tablerow         android:id="@+id/tablerow6"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="20sp">          <textview             android:id="@+id/eotheralloancetext"             android:layout_width="260sp"             android:layout_height="wrap_content"             android:text="employee other alloances :"             android:textappearance="?android:attr/textappearancelarge"             android:textcolor="#000000"             android:textsize="30sp"/>          <edittext             android:id="@+id/eotheralloanceedit"             android:layout_width="350sp"             android:layout_height="wrap_content"             android:ems="10"/>     </tablerow> </linearlayout>   <tablerow     android:id="@+id/tablerow7"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_alignparentleft="true"     android:layout_marginbottom="24dp" >      <button         android:id="@+id/savebutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="60sp"         android:background="#ffffff"         android:text="save"         android:textcolor="#000000"         android:textsize="30sp" />      <button         android:id="@+id/cancelbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="130sp"         android:background="#ffffff"         android:text="cancel"         android:textcolor="#000000"         android:textsize="30sp" />      <button         android:id="@+id/resetbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="110sp"         android:background="#ffffff"         android:text="reset"         android:textcolor="#000000"         android:textsize="30sp" /> </tablerow> 

now @ on click function @ case r.id.b_save : , case r.id.b_cancel , case r.id.b_reset , gives error "cannot resolved or not field" . have cleaned project , restarted , working eclipse , same error when make textviews clickable in class related same project, can possible solutions? have tried , can see r.java file in directory

thank !

you have use

case r.id.b_save:           break;      case r.id.b_cancel:           break;      case r.id.b_reset: 

you should use

case r.id.savebutton:           break;      case r.id.cancelbutton:           break;      case r.id.resetbutton: 

:) hope idea


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -