forked from deveshp007/Android-App-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP15_a.kt
46 lines (37 loc) · 1.27 KB
/
P15_a.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package alpha.beta.dex_three
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.ListView
class MainActivity : AppCompatActivity() {
lateinit var lst_view: ListView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var foods = arrayOf(
"Burger 🍔",
"Pizza 🍕",
"Chocolate 🍫",
"Coffee ☕",
"Shahi Paneer 😋",
"Cold Drink 🍷",
"Gulab Jamun 🍨",
"Paneer Tikka 🥘",
"Rice Bowl 🍚",
"Dahi Bhalle \uD83D\uDE0B",
"Malai Kofta \uD83D\uDE0B",
"Paneer Dosa 🍕",
"Ice Cream 🍦"
)
lst_view = findViewById(R.id.lst_view)
val adapter = ArrayAdapter(this, R.layout.card_design, R.id.mainText, foods)
lst_view.adapter = adapter
lst_view.setOnItemClickListener { adapterView, view, i, l ->
var t1 = foods[i]
val intent = Intent(this, MainActivity2::class.java)
intent.putExtra("name", t1)
startActivity(intent)
}
}
}