I'm trying to retrieve the current application's context indirectly
from an object that my application uses. For example, I have a MyApp
class that extends Activity which itself extends Context. From within
MyApp I declare a variable of type Foo, where Foo is a utility class I
define for whatever purpose. Is there any way for
DoSomethingWithCurrentContext() to retrieve MyApp's context without
explicitly passing the context into it as a parameter using
getApplicationContext()?
// MyApp.java...
public class MyApp extends Activity {
...
private Foo foo;
...
public MyApp() {
foo.DoSomethingWithCurrentContext();
...
}
...
}
// Foo.java...
public class Foo {
...
public DoSomethingWithCurrentContext() {
// can't call getApplicationContext() here since Foo doesn't
extend Activity or Context
....
}
....
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---