calling a button or a textfield from another class | android -
i have tried use edittext in list select listener can't see main activity taking me error @
edt.setvisibility(view.visible);
so please if have around me
public class mainactivity extends activity { static int hello_id = 1; boolean flag = false; countdowntimer timer; //the strings of notifications string titlepills = "time take panadol",descriptionpills = "panadol"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); spinner spinner = (spinner) findviewbyid(r.id.spinner1); arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.planets_array, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter); spinner.setonitemselectedlistener(new spinneractivity()); chronometer test = new chronometer(this); button btn = (button)findviewbyid(r.id.button1); edittext edt = (edittext)findviewbyid(r.id.edittext1); //hide button , edit text btn.setvisibility(view.gone); edt.setvisibility(view.gone); } //********************************************************************************* public class spinneractivity extends activity implements onitemselectedlistener { public void onitemselected(final adapterview<?> parent, view view, int pos, long id) { string select = parent.getitematposition(pos).tostring(); if(select.equals("type timee")) { //edt error can't resolved edt.setvisibility(view.visible); }
try this..
edittext edt;
as globle variable
edt = (edittext)findviewbyid(r.id.edittext1);
Comments
Post a Comment