java - Call a method of "Activity extended" class from "ListActivity extended" -


here snippet of "mybaseactivity" class.

public class mybaseactivity extends activity {       public void resetdisconnecttimer()        {          disconnecthandler.removecallbacks(disconnectcallback);          disconnecthandler.postdelayed(disconnectcallback, disconnect_timeout);        }         @override         public void onuserinteraction()        {            resetdisconnecttimer();         }  } 

my app contains many classes extend "activity" , couple of others extend listactivity. classes, extending activity, can extend "mybaseactivity" , call method as:

     @override      public void onuserinteraction()      {         resetdisconnecttimer();     } 

but classes extending listactivity ? ideas how can solve ??

you can switch fragments so:

class myactivity extends mybaseactivity {  @override protected void onuserinteraction() {..} }  class mybaseactivity extends fragmentactivity { protected void onuserinteraction() {...} } 

then of subclasses of baseactivity have listfragment in them. make porting easier assign id of @android:id/list listfragment.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -