android - Why do filestreams need a context? -
i've been working on developing library company past couple months , have been annoyed fact filestreams seem need context whenever store or load data internal storage.
i have designed library work :
- a singleton class made providing , handling keychain(containing app key , device id) , authinfo(user , password)
whenever request call web service made calling class attempt instance of singleton class , keychain , auth info through such :
singletonclass.getinstance().getcredentials(context ctx);
the result of need provide context of calling activity of library revolves around calling api credentials , device id parameters.
i referring these lines :
.... fileoutputstream fos = ctx.openfileoutput(filename, context.mode_private); fos.write(buf); fos.close(); .... i confused why specific context of activity calling needed. appreciated. there way of solving design issue ?
the application context should work - consider using method: using application context everywhere? can application context without having pass around.
Comments
Post a Comment