Kod:
@Override
public void onCreate() {
// Start up the thread running the service. Note that we create a
// separate thread because the service normally runs in the process's
// main thread, which we don't want to block. We also make it
// background priority so CPU-intensive work will not disrupt our UI.
HandlerThread thread =
new HandlerThread( "gfcjc",
Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
// Get the HandlerThread's Looper and use it for our Handler
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
Netbeans wyrzuca błąd:
internal error; cannot instantiate HandlerThread(java.lang.String,int) at android.os.HandlerThread to ()
przykłąd kodu jest ze strony Androida: http://developer.android.com/guide/components/services.html