SQLite数据库"上下文中,QUOT;传递到适配器适配器、文中、上下、数据库

由网友(梦想的天空分外蓝)分享简介:我跟本教程使用SQLite数据库在我的Andr​​oid应用程序。因为我是一个初学者,我有问题的理解用在这个例子中背景参数。I have followed this tutorial to use SQLite db in my android app. Since I am a beginner I'm hav...

我跟本教程使用SQLite数据库在我的Andr​​oid应用程序。 因为我是一个初学者,我有问题的理解用在这个例子中背景参数。

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

阅读全文

相关推荐

最新文章