--You should fill the Context in the constructor. --If you write in a local sentence, Context will be set in Helper as it is empty.
OK
HogeAppDao.java
public class HogeAppDao {
private Context mContext;
private HugaHelper hugaHelper = new HugaHelper(mContext);
public HogeAppDao(Context context) {
mContext = context;
hugaHelper = new HugaHelper(mContext);
}
//Method to get information of all users
public List<UserInfoEntity> selectAll() {
...
};
}
NG
HogeAppDao.java
public class HogeAppDao {
private Context mContext;
private HugaHelper hugaHelper = new HugaHelper(mContext);
public HogeAppDao(Context context) {
mContext = context;
}
hugaHelper = new HugaHelper(mContext);
//Method to get information of all users
public List<UserInfoEntity> selectAll() {
...
};
}
Recommended Posts