ActionbarSherlock NavigateUpTo

Hello

i'm trying to implement the up feature in a sample solution
I'm using VS2012 / Android ( Compiling API 18 and Min Level 10 )

I have a "start" Activity with a button that use StartActivity(typeof(StandardActivity));
=> display StandardActivity from which i want to go back to StartActivity using the Up feature

[Activity(Label = "Start", MainLauncher = true)]
public class StartActivity : Activity

[Activity(Label = "Standard", ParentActivity = typeof(TestActionBar.StartActivity))]
public class StandardActivity : Xamarin.ActionbarSherlockBinding.App.SherlockActivity
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

        //SetTheme(Resource.Style.Theme_Sherlock);

        SetContentView(Resource.Layout.Standard);          
        SupportActionBar.SetDisplayHomeAsUpEnabled(true);
    }

the up button is properly displayed but no action is processed
( Commented/uncommented line SetTheme do nothing more )

So i have tried to implement
public override bool OnOptionsItemSelected(Xamarin.ActionbarSherlockBinding.Views.IMenuItem item)
but without any success !!

I can't find any ressource value for the item.ItemId parameter passed when the home button is pressed
Resource.Id.homeAsUp or Resource.Id.abs__home doesn't mach the id i'm getting

So i have tried
try
{
var intent = new Intent(this, typeof(StartActivity));
NavigateUpTo(intent);
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);

        }

I'm getting an exception : Exception of type 'Java.Lang.NoSuchMethodError' was thrown.

If someone has any idea it will be appreciated because i'm stuck

Regards
Laurent
ps : i have successfully implemented tabs navigation, viewpager and SherlockFragmentActivity in my dev solution

Posts

  • Just to add that if i'm running an AVD with Android 4.3 the up button works like a charm
    without any implementation of OnOptionsItemSelected

    So i'm wondering what i'm missing,
    I have chosen ActionbarSherlock to handle lower compatibility

Sign In or Register to comment.