Android saving data in Internal Storage NullPointerException

限于喜欢 提交于 2019-12-06 11:40:27

CallingActivity.java

onCreate()

helperClass mHelper= new helperClass(CallingActivity.this);

helperClass.java

//declare a context
context refContext;

//constructor
public helperClass(context mContext)
{
   refContext=mContext;
}

//and you code

    hash= jsonObj.getString("hash");
    Log.w("CLIENT AUTH HASH","SHOW CLIENT AUTH HASH : "+hash);                  
    FileOutputStream out = refContext.openFileOutput("autohash",Context.MODE_PRIVATE);
    out.write(hash.getBytes());
    out.close();

try with this one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!