I'm trying to reuse the following Java code in Kotlin:
SimpleCursorAdapter scAdapter = new SimpleCursorAdapter(this,
R.layout.textsummarylistentry, mMatrixCursor,
from, to);
setListAdapter(scAdapter);
When I copy and paste this into a Kotlin class which extends ListActivity, and accept Android Studio's automatic conversion to Kotlin I get the following:
var scAdapter : android . widget . SimpleCursorAdapter ? =
SimpleCursorAdapter(
this,
R.layout.textsummarylistentry, mMatrixCursor,
from, to
)
listAdapter = scAdapter
There are numerous errors which Quick Fix is unable to resolve. How should I correct this code?
I think this should work:
var scAdapter = SimpleCursorAdapter(this, R.layout.textsummarylistentry, mMatrixCursor, from, to)
setListAdapter(scAdapter)
Share the error message if this doesn't works.