java - "Add cast to textview" in Eclipse -


i'm doing teamtreehouse android course , have problem. have code line:

textview answerlabel = findviewbyid(r.id.textview1); 

and after moving cursor on text "findviewbyid" should see window "add cast textview" , code line should looks here:

textview answerlabel = (textview) findviewbyid(r.id.textview1); 

but in example happens nothing (there no window "add cast textview).

do know, reason , how fix problem? did: project - clean, didn't anything,

will grateful answers. :)

this how mainactivity.java looks:

public class mainactivity extends activity {  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);   textview answerlabel = findviewbyid(r.id.textview1);   }   @override public boolean oncreateoptionsmenu(menu menu) {      // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();     if (id == r.id.action_settings) {         return true;     }     return super.onoptionsitemselected(item); } 

}

and activity_main.xml

<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.tree2.mainactivity$placeholderfragment" >  <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"     android:layout_centervertical="true"     android:text="textview" />  <button     android:id="@+id/button1"     style="?android:attr/buttonstylesmall"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_below="@+id/textview1"     android:layout_centerhorizontal="true"     android:text="button" /> 

but how should like?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -