Question

I have a MainActivity class that extends FragmentActivity and a SecondActivity that extends Fragment. Now I want to do a class BaseActivity and my classes extend it. How I can do? thanks.

public class MainActivity extends FragmentActivity implements LocationListener, OnClickListener{

    ...

    // THIS LINE USE FRAGMENTACTIVITY ONLY
    mapa = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapaMain)).getMap();

   ...

}

public class SecondActFragment extends Fragment implements OnClickListener, LocationListener { 

      ...
} 
Was it helpful?

Solution

Why do you need a BaseActivity? create a class BaseFragmentActivity and extend FragmentActivity, override the things you need to override there and then you extend your MainActivity as BaseFragmentActivity instead

OTHER TIPS

I think you need two base classes - BaseActivity (or BaseFragmentActivity) and BaseFragment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top