Some methods can't be resolved - android -
i new android. have activity fragmenttabsactivity extends fragmentactivity
, , implements tabs using tabhost
(i know deprecated, better understand). when tab active, want display list item content.
this list defined class tabfragment extends listfragment
. now, have
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { mprogressbar = (progressbar) findviewbyid(r.id.progressbar); .... } .... private boolean isnetworkavailable(){ connectivitymanager manager = (connectivitymanager) getsystemservice(context.connectivity_service);
the problem neither findviewbyid
, nor getsystemservice
recognized. why ?
converting comments answer
findviewbyid
method of activity
inflated there couple ways can here simplest change
mprogressbar = (progressbar) findviewbyid(r.id.progressbar)
to
mprogressbar = (progressbar) getview().findviewbyid(r.id.progressbar)
by calling method on inflated view
activity
.
for getsystemservice()
need use reference activity
fragment
attached to use method change
getsystemservice(context.connectivity_service);
to
getactivity().getsystemservice(context.connectivity_service);
Comments
Post a Comment