进口不在Android Studio中使用

出于某种原因,非Android导入不适用于我拥有的Kotlin类。 他们使用onCreate方法在其他类中工作,但不能使用此适配器类。 在这个类中没有onCreate方法的问题是什么? 我试图使用“import org.jetbrains.anko。*”,但它不起作用。

package com.example.christophrrb.firebasetest import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.Button import android.widget.TextView import org.jetbrains.anko.* /** * Created by Owner on 11/10/2017. */ class ViewPeople : AppCompatActivity() { var peopleList: MutableList<Person> = mutableListOf() //This list stores all of the database value entries. val ref: DatabaseReference = FirebaseDatabase.getInstance().getReference("people") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.view_people) ref.addValueEventListener(object: ValueEventListener { //Once you get into these functions, p0 is your new variable that you're working with. override fun onCancelled(p0: DatabaseError?) { alert("There was an error connecting to the database. Try checking your connection.") } override fun onDataChange(p0: DataSnapshot?) { //ref contains everything in the database node. peopleList.clear() //This clears the list so when new data comes up, it doesn't keep the old data in the list. if (p0!!.exists()) { //This means basically "if some data exits on the database. for(p in p0.children) { val person = p.getValue(Person::class.java) //The getValue method takes a Java class. peopleList.add(person!!); } //This connects to the layout class. val adapter = PeopleAdapter(this@ViewPeople, R.layout.people, peopleList) listView.adapter = adapter } } }) } }