java - Android AsyncTask use openFileOutputStream -
i have error in asynctask. tried save data fileoutputstream file, cause need data permanent.
so iam reading tutorial: tutorial
but if iam adding code asynctask error:
"the method openfileoutputstream(string, int) undefined type mainactivity.downloadspielplan"
downloadspielplan asynctask
private class downloadspielplan extends asynctask <void, void, string> { @override protected void onpreexecute() { // todo auto-generated method stub super.onpreexecute(); } @override protected string doinbackground(void... params) { // todo auto-generated method stub //dont wonder reversestring created , filled delete part code more readability filename = "spieltag"; jour = reversestring; fileoutputstream fos = openfileoutputstream(filename, context.mode_private); fos.write(jour.getbytes()); fos.close(); return reversestring; } @override protected void onpostexecute(string reversestring) { // todo auto-generated method stub toast.maketext(getapplicationcontext(), "download abgeschlossen!", toast.length_long).show(); super.onpostexecute(reversestring); } }
i guess problem is, iam calling openfileoutputstream asynctask, cant find solution how fix it. (cause iam realy new in android)
method name openfileoutput, not openfileoutputstream
call
mainactivity.this.openfileoutput(filename, context.mode_private)
instead of
openfileoutputstream(filename, context.mode_private)
in doinbackground method.
Comments
Post a Comment