Home > database >  How to do i convert the piece of kotlin code in java?
How to do i convert the piece of kotlin code in java?

Time:01-23

Hello Developers , I am trying to build a bottomsheet in android studio by the help of a YouTube video. But in the video the youtuber use kotlin and I don't know kotlin. I have already complete the layout part but I stucked in the code section.

For the video click here Or Use this link enter image description here

Step-3: Decompile Code In the bytecode window, checkbox the option “JVM 8 target” and click on Decompile. The Android Studio will generate the Java equivalent code for the Kotlin file. enter image description here

I hope this may be helpful in the last case.

CodePudding user response:

In Java it will look something like this:

BottomSheetBehavior<FrameLayout> behavior = BottomSheetBehavior.from(bottomsheet);
behavior.setPeekHeight(200);
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
  •  Tags:  
  • Related