Hay, I’m curious if you could share the source code of the two file
you are talking about here and maybe a usage example...

Thanks,

Dan

On Apr 25, 6:18 pm, Streets Of Boston <[email protected]> wrote:
> The option from Valentin in stackoverflow doesn't work well with the 
> *compatibility
> library*. This is what i did to make it MapActivity work with Fragments
> using the compatibility library (it is not the best solution, but it seems
> to work so far):
>
>    1. Use the source of the compatibililty library (just copy android/* into
>    your project's source dir).
>    2. Rename (don't refactor!) FragmentActivity.java into
>    AFragmentActivity.java (rename file and class-name).
>    3. Create a new java file FragmentActivity.java. Make it an interface
>    (see below).
>    4. Have AFragmentActivity implement FragmentActivity.
>    *public class AFragmentActivity extends Activity implements
>    FragmentActivity ... *
>     1. Fix the compiler errors that will happen.
>       2. instead of .mFragments, use getFragments()
>       3. instead of mHandler, use getHandler()
>       4. add casts that will cast FragmentActivity into Context or Activity
>       where necessary.
>       5. etc.
>       5. After all compiler errors have been fixed, make a copy of
>    AFragmentActivity.java and call it AFragmentMapActivity.java and have it
>    extend MapActivity
>    *public abstract class AFragmentMapActivity extends MapActivity
>    implements FragmentActivity ...*
>
> Now you can have a MapView in a regular fragment as long as that fragment is
> hosted inside a AFragmentMapActivity.
>
> Source of the FragmentActivity interface (without the imports and such):
> *package android.support.v4.app;*
> *...*
> *...*
> *public interface FragmentActivity {
>  public ClassLoader getClassLoader();
>  public View findViewById(int mViewId);
>  public Context getApplicationContext();
>  public Resources getResources();
>  public Window getWindow();      
>  public LayoutInflater getLayoutInflater();
>  public boolean isFinishing();
>  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo
> menuInfo);*
> **
> * public FragmentManagerImpl getFragments();
>  public Handler getHandler();*
> **
> * public LoaderManagerImpl getLoaderManager(int mIndex, boolean
> mLoadersStarted, boolean b);
>  public CharSequence getText(int mBreadCrumbTitleRes);
>  public void invalidateFragmentIndex(int mIndex);
>  public void onAttachFragment(Fragment f);
>  public void startActivityFromFragment(Fragment fragment, Intent intent, int
> i);
>  public void supportInvalidateOptionsMenu();
>
>
>
> }*- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to