SQLite数据库"上下文中,QUOT;传递到适配器 [英] SQLite Database "context" passed to adapter
问题描述
我跟本教程使用SQLite数据库在我的Android应用程序。 因为我是一个初学者,我有问题的理解用在这个例子中背景参数。
I have followed this tutorial to use SQLite db in my android app. Since I am a beginner I'm having problems understanding "context" parameter used in the example.
我想从一个类没有延伸至极的活动在这个例子中调用适配器插入/更新/删除记录表示上下文。
I want to call adapter and insert/update/delete records from a class that does not extend activity wich in this example stands for context.
现在我不知道通过在适配器的情况下什么,因为我不是从活动调用适配器。
Now I don't know what to pass in the adapter as context, since im not calling adapter from activity.
有人可以解释一下吗?
推荐答案
通过ActivityName.this的类上下文参数到适配器类的构造函数 该ActivityName是Activityclass在您所呼叫的适配器名称
Pass the ActivityName.this as class context as argument to the adapter class's constructor the ActivityName is the name of the Activityclass in which you are calling the adapter
这篇关于SQLite数据库"上下文中,QUOT;传递到适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!