I want to delete the long clicked line in my dynamic list I created. But I couldn't write adapter. I would be glad if you can help. If interested, I can edit the more necessary code blocks.It is not necessary to delete it with a long click. I am open to other suggestions.
Customers.kt
var compnameList=ArrayList<String>()
lateinit var toggle: ActionBarDrawerToggle
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_customers)
supportActionBar!!.setTitle("Müşteriler")
getDataParse()
listView.setOnItemClickListener { adapterView, view, i, l ->
val intent=Intent(applicationContext,CustomersDetails::class.java)
intent.putExtra("Name",compnameList[i])
startActivity(intent)
}
listView.setOnItemLongClickListener { adapterView, view, i, l ->
//İt'snot define
}
}
fun getDataParse(){
val search=findViewById<SearchView>(R.id.searchView)
val listView=findViewById<ListView>(R.id.listView)
val arrayAdapter=ArrayAdapter(this,android.R.layout.simple_list_item_1,compnameList)
listView.adapter=arrayAdapter
registerForContextMenu(listView)
Here is the code edited with a basic list view adapter, if this is what you need: