Closed takaaptech closed 3 years ago
Hello @takaaptech :)
In Java the setup looks a bit different. The library is written in Kotlin. I just set up a Java project, and it has to look like this:
new InfoSheet().show(context, null, (Function1<? super InfoSheet, Unit>) sheet -> {
// Setup the sheet here
sheet.title("Title");
sheet.content("Test");
return null;
});
You can also just use build()
if you want to show it later with show()
Hi @maxkeppeler
On Java Activity, inside onCreate I just call InfoSheet sheet = new InfoSheet(); sheet.show(); // Show sheet when ready
But the program crash with this bellow error: Please help! Thank you so much!
kotlin.UninitializedPropertyAccessException: lateinit property windowContext has not been initialized at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3512) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3684) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2126) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8052) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Caused by: kotlin.UninitializedPropertyAccessException: lateinit property windowContext has not been initialized at com.maxkeppeler.sheets.core.SheetFragment.getWindowContext(SheetFragment.kt:56) at com.maxkeppeler.sheets.core.SheetFragment.show(SheetFragment.kt:279)