I am currently working in a Class Library (Android) project. This project is suppose to work with multiple other projects, therefore there is no way to know in advance which Theme each main project might have. However, I intend to use v7.AlertDialog which does not work without a Theme.AppCompat on its application tag of the manifest but there is no Manifest for Class Libraries (Android).
I had success by requesting permissions and features using the assemblyinfo.cs file. Now I am trying to add the following:
[assembly: Application(Theme = "@android:style/Theme.AppCompat.Light")]
However when this code runs it fails:
AlertDialog7.Builder builder = new AlertDialog7.Builder(this);
AlertDialog7 alert = builder.Create();
alert.Show();
Output: Unhandled Exception: Java.Lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
If I add this to the application tag then the project runs without any problems:
android:theme="@style/Theme.AppCompat.Light"
I have tried to add the Theme to the AlertDialog which also failed:
AlertDialog7.Builder builder = new AlertDialog7.Builder(this, <THEME>);
Also tried to add to the Activity tag which also failed:
[Activity(Theme = <THEME>)]
Question: How can I make sure the Class Library (Android) will work fine independently of the main project theme and how can I add the theme to the Class Library project without using the main project Manifest?