getContext() doesn't exist

前端 未结 4 1757
Happy的楠姐
Happy的楠姐 2021-02-20 12:29

So I have been going through the Android Developer training on the official site and there is a point where they want us to finally instantiate our database.

So they te

4条回答
  •  野性不改
    2021-02-20 12:56

    Thats how I made it

    1. MainActivity

      FeedReaderContract contract = new FeedReaderContract(this);

    2. I edited the constructor of the class FeedReaderContract

      mDbHelper = new FeedReaderDbHelper(getContext());

    3. The method getContext()

      public Context getContext() { return context; }

提交回复
热议问题