how to generate new card view while i am touching ...
# android
a
how to generate new card view while i am touching button in kt
s
you create the card view in the touch listener?
a
then
s
you add it to the view
there isn't anything special about doing it
a
but my question is i have no card view then when i click a button it generate new card view
s
Right. Do what I said
if you run into issues doing that, then you probably want to share your code and point out specifically what part you're having trouble with
a
how to add the cardview in touch listner
wait letme send you my code
s
you just do it
a
btn1.setOnClickListner{}
s
that's not code
you need to write an actual click listener before you can worry about the other stuff
You need to understand how to use buttons first: https://developer.android.com/guide/topics/ui/controls/button
a
Copy code
val btn1: Button = findViewById(R.id.btn1)
        btn1.setOnClickListener { 
            cardview
        }
in the place of cardview what i have to add to generate new cardview while i am clicking the button
s
the same thing you would normally add to generate a cardview
a
this question is asked and solved in java would tell me in kotlin
s
the technique is the same
a
then how do i converted to kotlin
s
you should learn Kotlin before you try to do that
you can also open a scratch file in Android Studio, paste the Java code in, and it will convert to Kotlin for you
a
ok wait i will try
but there is many answer i don`t know which works
s
try them
start with the first one
a
View.add(view)
Thank you very much it works