A large percentage of examples that I find online inherit from AppCompatActivity rather than Activity. Is this really what I should be doing? I have heard that Activity is newer, and it is my preference. I am currently attempting to learn to use CameraX, and there are very few examples & support that I have been able to find for Xamarin.Android. After finding the following Android tutorial & a translation of it for Xamarin.Android:
https://developer.android.com/codelabs/camerax-getting-started
https://github.com/DottorPagliaccius/Xamarin.CameraX
However, the first parameter of BindToLifecycle seems to like AppCompatActivity but not Activity. Does anybody know what changes I need to make in order to be able to use Activity instead of AppCompatActivity?
Actually,
AppCompatActivityis newer thanActivity.AppCompatActivitysupports some of the newer platform features on older Android devices. Some of these backported features include: Using the action bar, including action items, navigation modes and more with thesetSupportActionBar(Toolbar) API.But don't be worry about trouble of using
AppCompatActivity.It's similar to usage ofActivity. You said that the first parameter ofBindToLifecycleseems to likeAppCompatActivitybut notActivity. In fact, you can treat it likeActivityto use.For more details about
AppCompatActivityandActivity, you can check: https://stackoverflow.com/questions/31297246/activity-appcompatactivity-fragmentactivity-and-actionbaractivity-when-to-us#:~:text=The%20differences%20between%20them%20are%3A%20Activity%20is%20the,Based%20on%20FragmentActivity%2C%20AppCompatActivity%20provides%20features%20to%20ActionBar.