Calling a function that has 'Activity' as an argument.
Posted
by Andrew
on Stack Overflow
See other posts from Stack Overflow
or by Andrew
Published on 2010-04-07T03:58:14Z
Indexed on
2010/04/07
4:03 UTC
Read the original article
Hit count: 262
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!
© Stack Overflow or respective owner