1

The requirement of my watch application is that we need to implement a view pager in it. I have implemented the same in my Android app. In my Android app I am using the following classes:

HomeActivity extends FragmentActivity

// is of type support v4

CustomViewPager extends ViewPager

//is of support type v4

HomeFragmentPagerAdapter extends FragmentStatePagerAdapter

//is of type support v4

My Android Wear activity extends

WearHomeActivity extends WearableActivity

So here I cannot use getFragmentManager() and other such methods since other classes are of type support v4, neither can I extend my activity to FragmentActivity since I have already extended it to wearable.

So what is the solution for this?

TofferJ
  • 4,678
  • 1
  • 37
  • 49
Pritish
  • 1,284
  • 1
  • 19
  • 42
  • Yes you can! android.support.wearable.activity.WearableActivity extends Activity, and that's where the getFragmentManager() method lives. – TofferJ Jun 14 '18 at 18:08
  • @TofferJ thanks for the reply, that is exactly what I cannot use, if I am using support fragment manager for other files , I cannot use getFragmentManager , I need to use getSupportFragmentManager(), which is not available in WearableActivity – Pritish Jun 15 '18 at 06:57
  • You don't need to use the support v4 library for your wearable app. If you by "other classes are of type support v4" mean that some of your classes that you want to share between the app are based on the support v4 library, I suggest that you create a base class that's not and then extend support v4 specifically for your Android app, and not the wearable app. – TofferJ Jun 15 '18 at 13:39

0 Answers0