开发者

Android: Why i got a slash in the full qualified class name and "WARN/ActivityManager(52): Unable to start service Intent"

I try this tutorial for building a Widget for Android Homescreen.

http://www.helloandroid.com/files/xmaswidget/android_howto-hellowidget.pdf

But if i try to start the example with the Service (the second way in that tutorial) i got in the LogCat of DDMS the following error message:

WARN/ActivityManager(52): Unable to start service Intent { cmp=de.tlindig.android/.HelloWidget$UpdateService }: not found

What i not understand is, where slash ("/") after the package name comes from.

I also add a log-statement ahead of the service creation to check, whats going in. The code looks like this:

@Override

public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {

  Log.d("HelloWidget.onUpdate", "UpdateService.class is: " + UpdateService.class);
  Intent intent = new Intent(context, UpdateService.class);
  context.startService(intent);
 }

And so i got the following output in the LogCat:

DEBUG/HelloWidget.onUpdate(320): UpdateService.class is: class de.tlindig.android.HelloWidget$UpdateService
WARN/ActivityManager(52): Unable to start service Intent { cmp=de.tlindig.android/.HelloWidget$UpdateService }: not found

I work on Windows 7 64bit with eclipse. I did copy the code step by step direct from the tutorial. I tried also own example, but got the开发者_如何转开发 same error. In both cases i got that slash in the path.

Have anybody a idea what i doing wrong?

Thanks for you help.


I found the solution by my self.

Every Service needs a entry in the Manifest-File. In my case it looks like this:

<service android:name=".HelloWidget$UpdateService" />

that is it. Now the service was found and started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜