Calling a function that has 'Activity' as an argument.
- by Andrew
I have stripped down my functions for simplicity:
public static int countLines(String fileName, Activity activity) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(activity.getAssets().open(fileName)));
return 3;
}
I am calling it from here:
private CharSequence RandomRead() throws IOException {
int numberLines = countLines("data.txt", ??????);
return "Success"
}
In the call to countLines("data.txt", ??????), what do I put as the argument for the Activity? I've Googled all night and I can find no examples of an actual call to a function where Activity is an argument. (Lots of examples actually using 'activity', but no calls to the example functions).
Thanks!