开发者

Questions for Context in Android. How does it work and why?

I'm trying to figure out what is the use of the context when it is being passed back into the constructor in an example below , can anyone h开发者_StackOverflow社区elp to give a more layman explanation and its possible use ? Thank you !

public static class DatabaseHelper extends SQLiteOpenHelper {

    public final Context myContext;

    public DatabaseHelper(Context context) {

        super(context, DB_NAME, null, 1);

        this.myContext = context;

    }


In Android Context contains all information about your application, and I believe it's used here to prevent your application access all databases but yours. That's why we need the Context...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜