I'm upgrading my old project to use latest android apis, gradle build, etc... and I'm running into this issue with my Android Manifest.
I have a few activities set like below:
<activity
android:name="com.company.name.ui.ColorPickerActivity"
android:label="@string/title_activity_add_photo_library"
android:parentActivityName="com.compant.name.ui.CaptureMenuFragment"
android:screenOrientation="portrait"
android:theme="@style/FullscreenTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.company.name.ui.CaptureMenuFragment" />
</activity>
Where I get a error that says:
Fragment is not assignable to 'android.app.Activity'
In reference to the android:parentActivityName above. What should it be instead? It was working in previous target api setting.
I looked through some SO posts and they mention changing Fragment to FragmentActivity but that causes other build issues like I can't use "getActivity()
" method in my intent instance.
E.g: Intent intent = new Intent(getActivity(), SearchProductActivity.class);
Is there a better solution to this?
Thanks!
EDIT:
Even with regards with BindingFragmentActivity, in my manifest it says:
com.company.name.ui.ColorActivity' is not assignable to 'android.app.Activity'
After I upgrade to API 28 and Android X. What is wrong with this code in my manifest:
<activity
android:name="com.company.name.ui.ColorActivity"
android:label="@string/title_activity_color"
android:parentActivityName="com.company.name.ui.ColorsActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.company.name.ui.ColorsActivity" />
</activity>