Extend Activity with MapActivity and ActivityGroup - android

I'm new in Android.
How am I be able to extend an Activity with both MapActivity and ActivityGroup??
Because I need to display both a Map and a customized Tab on an Activty.
public class MainActivity extends ActivityGroup implements MapActivity
Somehow I'm not allowed to do that.

To display a tab use Fragment, coz ActivityGroup is Depreciated.

Related

Main activity with a menu and map fragment (Android app)

My main activity extends AppCompatActivity where I create and inflate my menu. I also want my main activity to contain a map fragment. This requires that my main activity extends FragmentActivity, but I cannot extend from two super classes. How am I supposed to add a map fragment to my main activity?
AppCompatActivity extends FragmentActivity, so you get all of the functionality in FragmentActivity by extending AppCompatActivity.
Well, AppCompatActivity already extends FragmentActivity, so there should be no problem.

Calling a DialogFragment from a ListActivity

I have an android application with a main activity extending a listactivity.
public class Main_activity extends ListActivity {...}
Out of the options menu, I want to send a part of the items via mail. To select the items, I want to display a dialogfragment.
Everything works fine, but I have to start a new intent (loosing my listview), this extending FragmentActivity, as it is not possible to use getSupportFragmentManager out of the ListActivity.
startActivity (new Intent (this, Fragment_Activity.class));
and
public class Fragment_Activity extends FragmentActivity implements EditNameDialogListener {...}
Is there any possibility to display the DialogFragment directly from my Main_activity? What do I have to change?
I would suggest that you change Main_activity to extend FragmentActivity and move your list code to a ListFragment. With your main activity extending FragmentActivity it gives you the chance to show the dialog fragment without losing the ListView and the underlying data.
UPDATE: Since you don't want to change your current design I see two ways forward:
1 Move the list data out of the ListActivity and into a data model of some kind so that you don't lose it. Create a static class to hold the list data or store it in SharedPreferences.
2 Use a custom dialog instead of a DialogFragment

SlidingMenu Library with ActionBarSherlock

In the documentar from SlidingMenu is written down:
Go into the SlidingActivities that you plan on using make them extend Sherlock__Activity instead of __Activity.
The setup should be ok, I followed the guide, but if I try to extend my Activity with for example: SlidingSherlockFragmentActivity or SherlockSlidingFragmentActivity doesn't work.
If I extend my Activity with SherlockFragmentActivity I can't get the SlidingMenu with getSlidingMenu() or call setBehindContentView.
Nevermind, go into the SlidingMenu library and extend the Activity by SherlockFragmentActivity instead of FragmentActivity
Go to activities of library SlidingMenu and extends all activities to SherlockActivities corresponding, after go to your app and extends all activities to SlidingActivity corresponding.
Example: SlidingMenu:
SlidingActivity extends SherlockActivity
SlidingMapActivity extends SherlockMapActivity
Example: MyClass
MyClass extends SlidingActivity
MyClass extends SlidingMapActivity

MapActivity in a fragment

I have a FragmentActivity:
public class parking extends FragmentActivity { }
It has 3 tabs, the second and third are lists, solved.
public class tab2 extends Fragment{ }
But the first one is a map, so, I can't extend Fragment and a MapActivity.
How can I solve it?
There is no support for MapFragment, Android team says is working on it since Android 3.0. Here more information about the issue http://code.google.com/p/android/issues/detail?id=15347&utm_source=buffer&buffer_share=acc72
But what you can do is create a Fragment that returns a MapActivity. Here is a code example. Thanks to inazaruk: https://github.com/inazaruk/examples/tree/master/MapFragmentExample
How it works:
MainFragmentActivity is the activity that extends FragmentActivity
and hosts two MapFragments.
MyMapActivity extends MapActivity and
has MapView.
LocalActivityManagerFragment hosts
LocalActivityManager.
MyMapFragment extends LocalActivityManagerFragment and with help of TabHost creates
internal instance of MyMapActivity.
if you have any doubt please let me know
Google released the Map API Version 2. This finally allows us to use a MapFragment and a SupportMapFragment. This allows adding Maps to ViewPagers and to Activities that do not extend MapActivity.

Android app with setVolume.... extending TabActivity

hi i've an app where i want to implement setVolumeControlStream
but i can't because my class extends TabActivity not Activity. what shall i do ??
setVolumeControlStream() is available on TabActivity, because TabActivity inherits from Activity.

Categories

Resources