You are in the wrong group -- this group is for programming against the SDK, which you are well outside the bounds of.
That said, you can't really get a functional Context from outside of processes not launched by the activity manager. You'll notice that the monkey, am, and pm commands all don't use a Context for this reason. On Fri, May 15, 2009 at 6:41 AM, SGAdrian <sven.wastl...@gmail.com> wrote: > > Sorry but I dont get it. > > I am starting my java program with app_process, i.e I am not running > any Service or Activity. Just like the Monkey.java program is doing. > > Ex. > > public class Main { > public static void main(String[] args) { > // How can I get hold of a Context instance here? > // > } > } > > BR, > Sven > > On May 15, 2:50 pm, "Mark Murphy" <mmur...@commonsware.com> wrote: > > > When you are developing on an application level(Services, Activities) > > > you always get this Context reference automatically. > > > > > But what if I am on a lower level and developing a program started > > > with app_process, how can I get hold of a Context then? Its a huge > > > part of the API that need this context. > > > > Have it passed to you via the API to your lower level. In other words, > > just as the Android API requires you to pass in a Context, your API to > > your higher levels will require those higher levels to pass in a Context. > > > > > What the proper way to create a Context instance? > > > > AFAIK, you don't create Context instances -- you use the ones created for > > you by Android (e.g., Activity, Service). > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com > > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---