Pessoal help please!!
Revisei o código várias vezes mas não consigo implementar o adapter. Quando executo o app ele build sem erros e carrega o app, mas não exibe os blocos em branco conforme a aula.
ListaTransacoesAdapter.kt:
package br.com.lweb.financaskotlin.ui.adapter
import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter import br.com.lweb.financaskotlin.R
class ListaTransacoesAdapter(transacoes: List, context: Context) : BaseAdapter() {
private val transacoes = transacoes
private val context = context
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
return LayoutInflater.from(context).inflate(R.layout.transacao_item, parent, false)
}
override fun getItem(position: Int): String {
return transacoes[position]
}
override fun getItemId(position: Int): Long {
return 0
}
override fun getCount(): Int {
return transacoes.size
}
}
ListaTransacoesActivity.kt:
package br.com.lweb.financaskotlin.ui.activity
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.ArrayAdapter
import br.com.lweb.financaskotlin.R
import kotlinx.android.synthetic.main.activity_lista_transacoes.*
class ListaTransacoesActivity : AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_lista_transacoes)
val transacoes = listOf("Comida - R$ 20,50")
val arrayAdapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, transacoes)
lista_transacoes_listview.adapter = arrayAdapter
}
}