Flutter: Extend FlutterActivity AND AppCompatActivity - android

I'm trying to create an android plugin for Flutter that depends on using an AppCompatActivity (as it has a method that takes the embedding appcompatactivity as a parameter).
However, since my main activity extends FlutterActivity, I cannot simultaneously extend AppCompatActivity. I tried implementing it instead, but failed because of some redundancies.
Is there any way to hack this?
Thanks

extend AppCompatActivity vs extend flutterActivity
you can find your answer here

Related

FormsAppCompatActivity vs MainActivity

I am have interview tomorrow i am need to know the difference between FormsAppCompatActivity vs MainActivity.. I have searched ithe internet but from what i found it seems that MainActivity is the base class and FormsAppCompatActivity derives from MainActivity and the main difference seems to be in the tool bar ?
seen this
Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which?
Xamarin.Forms - FormsAppCompatActivity or ForsmApplicationActivity
https://forums.xamarin.com/discussion/115952/xamarin-forms-formsapplicationactivity-or-formsappcompatactivity
https://learn.microsoft.com/en-us/xamarin/android/user-interface/material-theme
MainActivity is the main class for a Xamarin Android project
FormsAppCompatActivity is the main class for a Xamarin Forms Android project

What does android.support.v4.app.FragmentActivity extend?

The webpage with the following address states that the class FragmentActivity extends the class Activity:
https://developer.android.com/reference/android/support/v4/app/FragmentActivity.html
However, when I bring up the documentation for the android.support.v4.app.FragmentActivity class within Android Studio, it states that FragmentActivity extends android.support.v4.app.BaseFragementActivityHoneycomb.
What is the reason for the discrepancy and which is correct?
This goes up to BaseFragmentActivityDonut. These base fragments are just an implementation detail of FragmentActivity and should not concern you at all. In the library I use, FragmentActivity directly extends BaseFragmentActivityJB. In the future there might be something like BaseFragmentActivityM or some compatibility layer for even newer platforms.
For your programming just assume it extends Activity only, like the documentation states.

How to extend ActionBarActivity and YoutubeBaseActivity?

Is there a way I can extend both of these in a single activity? If yes, please share with me the source code.
From another SO answer:
To reduce the complexity and simplify the language, Android does not support multiple inheritance as it's based on Java programming language. Hence you can't extend both ActionBarActivity and YoutubeBaseActivity in a Single Activity.
The solution is pretty simple: use the YouTubePlayerFragment class. This does not pose any requirement on the Activity, leaving you with plenty of options for your theming.
Since the version 22.1.0, the class ActionBarActivity is deprecated. You should use AppCompatActivity.
Note : ActionBarActivity is deprecated, use AppCompatActivity.
Instead of having the Youtube player in the Activity (extending YoutubeBaseActivity), make your Activity extends from AppCompatActivity and use a YoutubePlayerFragment inside the AppCompatActivity. You will be able to use all the features of AppCompat with your Youtube video.
If you REALLY want to use BaseYoutubeActivity, you have to add an AppCompatDelegate in your own Activity extending the BaseYoutubeActivity and use it in every lifecycle method of your activity. Read the documentation of the delegate and read the original source code of AppCompatActivity to understand the delegate.
You cannot do that for now. you can use fragment instead of activity in your Activity that extends AppCompatActivity
Please refer to this answer. https://stackoverflow.com/a/30101931/4321808

Android: How to extends my Activity class with RoboActivity + ActionBarActivity

I would like to use RoboActivity with my activity, but I don't know how to do that coz my current activity extends already ActionBarActivity:
public class MainActivity extends ActionBarActivity
Thank you so much
For RoboGuice 3 simply extend from RoboActionBarActivity.
You can simply copy the relevant RoboActivity parts into your subclass of ActionBarActivity. From the official docs https://github.com/roboguice/roboguice/wiki/Using-your-own-BaseActivity-with-RoboGuice:
In case your base activity class already extends a different library, the best way to get all the power of RoboGuice is to copy all the code contained in RoboActivity.
An example is also provided therein.

How to use multilevel inheritance in android

I am making an app in which i have to run an activity in background until the app is running.each activity related to this app is using first activity.how can it possible?
can i use the inheritance for this?
can anyone tell me any example of multilevel interitance in android?
You can create a BaseActivity class that extends Activity and all other Activities will extend this BaseActivity. Then what ever happened in all other activities (like resume and pause) will also effect the actions of BaseActivity.
If you have to accomplish background task you better to see android service
You are already extending the Activity class in a base class, and again you are extending this base class in other class. This is itself an example of multilevel inheritance. I am posting an example that may be relevant for your question:
public class basecls extends Activity{
/*The base class*/
}
public class secondcls extends basecls{
/* basecls extended by secondcls */
}
You can extend the secondcls in another class, and the new class will inherit all super classes such that you can use the methods of its super classes.
Your main activity is already using inheritance, since it extends the Activity class.

Categories

Resources