On Saturday, February 9, 2013 2:39:17 PM UTC-5, Mark Murphy (a Commons Guy) 
wrote:
>
> You claim that your problem is in onCreateOptionsMenu(), yet you do 
> not appear to implement it. 
>
>
Whoops, not sure what happened there, didn't paste Fragment:


*MyListFragment.class*

public class MyListFragment extends SherlockListFragment
{
    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        
        setHasOptionsMenu(true);
    }
    
    public static MyListFragment newInstance() {
        
        return new MyListFragment();
    }
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        
        return inflater.inflate(R.layout.listing, container, false);
    }    
    
    @Override
    public void onActivityCreated(Bundle savedState) {
        super.onActivityCreated(savedState);

        DisplayItems();
    }
    
    @Override
    public void onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);
    }
    
    @Override
    public void onCreateOptionsMenu(final Menu menu, final MenuInflater 
inflater) {
        inflater.inflate(R.menu.listing_menu, menu);

        super.onCreateOptionsMenu(menu, inflater);
    }
}

*MyDetailFragment.class*

public class MyDetailFragment extends SherlockListFragment
{
    public int mId;
    
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }
    
    public static MyDetailFragment newInstance(int id) {
          
        MyDetailFragment lf = new MyDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("id", id);
        lf.setArguments(bundle);
        
        return lf;
    }
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
Bundle savedInstanceState) {
        
        if (getArguments() != null)
            mId = getArguments().getInt("id");
        
        return inflater.inflate(R.layout.details, container, false);
    }
    
    @Override
    public void onActivityCreated(final Bundle icicle)
    {    
        super.onActivityCreated(icicle);

        DisplayItems();
    }
    
    @Override
    public void onPrepareOptionsMenu(Menu menu) {
        
        super.onPrepareOptionsMenu (menu);
    }
    
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.details_menu, menu);
        
        super.onCreateOptionsMenu(menu, inflater);
    }
}
 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to