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.
Related
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.
I'm using AppCompatPreferenceActivity, that is an Activity which extends PreferenceActivity and has an AppCompatDelegate. I want to add a headless fragment to this Activity, but I can't call to getSupportFragmentManager...
Is there a way to add fragments to a PreferenceActivity using AppCompatDelegate?
The only way to call getSupportFragmentManager is from a FragmentActivity or something which derives from it. PreferenceActivity derives from Activity which cannot use Fragments.
You should look into using a PreferenceFragment instead.
I have eclipse(Kepler) and latest sdk installed. Whenever i create a new activity inside android project, activity is extending ActionBarActivity. But i need new activity to extend Activity.class. How to do this?
There is no other way to extend an class with Activity.Class automatically other than changing declaration of the class manually.
In MainActivity.java, I extends TabActivity to use Tabhost.
public class MainActivity extends TabActivity
In each Tab, I use ActivityGroup to manage some child activity
public class MerchandiserTabGroupActivity extends ActivityGroup
In a child activity A, I want to start another child activity B.
Intent intCreateClaim = new Intent(mContext, MultiPhotoSelectActivity.class);
startActivityForResult(intCreateClaim, Parameter.ACTIVITY_SELECT_IMAGE);
After I call setResult(RESULT_OK) and finish() in Activity B, onActivityResult() in Activity A isn't called.
Can anyone helps me? Thanks in advance.
I know this isn't really the answer you're looking for, but you're using deprecated API. You should try a refactor and use the new Fragment API and the v4 support library if you need to support older versions of Android too. Using fragments you won't need to rely on setResult and onActivityResult.
Fragment
Fragment Tab Host
This happens because after B activity finishes, Android returns to your TabActivity, not your A activity.
Use fragments. This way you will not have to deal with multiple activities. You will have only one parent activity with fragments inside. To make your life easier and to add support for pre-ICS Android devices, try GrilledUI library.
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.