java - Android - The method findViewById(int) is undefined for the type -


can keep getting error im getting @ line of code

textview t1 = (textview)findviewbyid(r.id.textcocktailname); 

here's full code snippet:

package com.drunktxtapp;  import android.os.bundle; import android.widget.button; import android.widget.imageview; import android.view.view.onclicklistener; import android.content.intent; import android.widget.textview; import android.view.view;   public class cocktaildetail {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.bloody_mary);         imageview imageview1 = (imageview)findviewbyid(r.id.imagecocktail);         imageview1.setimagedrawable(getresources().getdrawable(r.drawable.bloodymary));         button b1 = (button) findviewbyid(r.id.byoutube);         textview t1 = (textview) findviewbyid(r.id.textcocktailname);         string cocktailname = getintent().getstringextra("bloody mary");         t1.settext(cocktailname);         b1.setonclicklistener(new button.onclicklistener() {             public void onclick(view v) {                 startactivity(new intent(intent.action_view, uri.parse("http://www.youtube.com/watch?v=alt-ehdc3fc")));                 }         });     } } 

public class cocktaildetail {  ... } 

needs be:

public class cocktaildetail extends activity { ... } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -