문제

I'm trying to figure out how to launch a Service from a singleton class I've created.

According to the Android documentation, startService is a method of Context. So, in the method call I am making to the singleton class, I figured I would pass on the application Context as a parameter. Easy enough. However, when I try to use that context.startService, it says startService is not a method of Context. So how do I actually launch a Service from my own class?

API 7

Why I'm doing this:

Despite the examples that have been provided with the Android SDK (where database calls are made directly from the UI), Virgil, in his 2010 Google I/O presentation suggested a few models for REST-heavy applications that behave differently. The one I'm attempting to follow is as such (as I understand it):

Activity calls "Service Helper" (singleton), Service Helper launches Service, Service queries database for Cursor, Service also launches thread which calls web service to update database, Service notifies Service Helper that is has completed querying for Cursor, Service Helper notifies Activity that it has Cursor.

도움이 되었습니까?

해결책

forehead smack

I see my problem:

import sun.org.mozilla.javascript.internal.Context;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top