-4

I am a beginner of Kotlin in Android and would like to create an pickerViewer (as below image) in Android Kotlin. enter image description here

I found https://github.com/Bigkoo/Android-PickerView on the web, but I don't know how to use it because the code is Java. I am asking for the solution with source code. Please kindly help.

GPH
  • 1,111
  • 6
  • 29
  • 49
  • SO is for asking question, not "teaching you with source code" -- which I assume means that you're asking for the solution – James Z May 23 '18 at 15:07
  • @JamesZ yes, thank you! I will update the question. – GPH May 23 '18 at 15:09
  • 2
    Welcome to Stack Overflow. Please show your latest non-working attempt at solving this problem. It is usually more instructive to see fixes to your code than to read someone else's solution. See https://stackoverflow.com/help/how-to-ask – Spangen May 23 '18 at 15:29

1 Answers1

0

java

TimePickerView pvTime = new TimePickerBuilder( this, new OnTimeSelectListener() {
    @Override
   public void onTimeSelect(Date date, View v) {
       Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show();
   } }).build();

kotlin

 val pvTime = TimePickerBuilder( this, {  date, v  ->
       Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show() 
   }  ).build() 

you can first code in java, then use "Code> convert to Kotlin" in the android studio, so that you can compare between the two.

Angel Koh
  • 12,479
  • 7
  • 64
  • 91
  • I would like to make a pickerview for country and city. Can you show me how to do it? – GPH May 23 '18 at 16:19