Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Is it possible to have a List of available activities to get one of them from this list using fabric

I trying to port app from WinCE to Xamarin.Android. This app is using states machine to switch between states (by user clicking or particular background processing). Every state has own view.
So, main idea is to keep in some provider all available views as List and show one of them by state switching. It might be activated from both UI thread or Worker thread. As the following:

public List<IView> Views { get; protected set; }
public virtual void Init()
    Views.Add(new MasterView());
    Views.Add(new LoginView());
    Views.Add(new MainMenuView());
public T GetView<T>() where T : InView
    return (T)Views.FirstOrDefault(view => view is T);

Every activity is inherited from base activity class.

[Activity(Label = "MasterView")]
    public class MasterView : BaseView, IMasterView
        protected override void OnCreate(Bundle savedInstanceState)

            // Create your application here

public class BaseView : Activity, IView  //is in class library project
        protected override void OnCreate(Bundle bundle)

Now, when Init method starts to add new MasterView i'm getting error "Java.Lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()"

All this stuff works like a charm under WinCE.
Will it work at Xamarin.Android? How to modify it?

Best Answer


Sign In or Register to comment.