开发者

Android/Java - Issue

开发者 https://www.devze.com 2023-01-19 18:53 出处:网络
The code is like this: private DatabaseHelper mOpenHelper; @Override public boolean onCreate() { mOpenHelper = new DatabaseHelper(getContext());

The code is like this:

private DatabaseHelper mOpenHelper;
@Override
public boolean onCreate() {
  mOpenHelper = new DatabaseHelper(getContext());
  System.out.println("done");
  return true;
}

Now Eclipse is showing me an error warning on the first line of this code "private DatabaseHelper mOpenHelper", that the object mOpenHelp开发者_运维知识库er is not used anywhere, whereas in the very next lines of code, I am initializing it. Please tell me why is this happening?

Thanks,

-D


Yes eclipse is right, You have initialized it and not using it anywhere. It would not complain if you use that mOpenHelper say in a getter method.


The warning doesn't say not be USED anyone, it's saying not being READ anywhere. And it's not. You're declaring it, assigning it, but not reading it.

0

精彩评论

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