Android未找到启动程序活动,android – 无法启动服务意图:未找到

我有与

here描述相同的问题,但我不明白是什么错了。

我的问题是:无法启动服务Intent {act = .connections.MoodyService} U = 0:未找到

编辑

*我已将源码中的连接更改为服务,不好意思,

我的清单

package="com.example.moody"

android:installLocation="auto"

android:versionCode="0"

android:versionName="0.6.7 alpha" >

android:maxSdkVersion="18"

android:minSdkVersion="14"

android:targetSdkVersion="17" />

android:allowBackup="true"

android:allowClearUserData="true"

android:icon="@drawable/ic_launcher"

android:label="@string/app_name"

android:theme="@style/AppTheme" >

android:name="activities.MainActivity"

android:label="@string/app_name" >

android:name="activities.Menu_esq"

android:label="@string/title_activity_menu_esq" >

android:name="activities.BaseActivity"

android:label="@string/title_activity_base" >

android:name="activities.MainView"

android:label="@string/title_activity_main_view" >

android:name="activities.LoginActivity"

android:label="@string/app_name"

android:noHistory="true"

android:windowSoftInputMode="adjustResize|stateVisible" >

android:name="com.example.moody.LeftActivity"

android:label="@string/title_activity_left" >

android:name="com.example.moody.RightActivity"

android:label="@string/title_activity_right" >

android:name="activities.UserDetailsActivity"

android:label="@string/title_activity_user_details" >

android:name="fragments.TopicsPreview"

android:label="@string/title_activity_copy_of_topics_preview" >

android:name=".service.MoodyService"

android:icon="@drawable/ic_launcher"

android:label="@string/moody_service" >

服务是包,MoodyService是类名

我的服务班

public class MoodyService extends Service {

public MoodyService() {

// TODO Auto-generated constructor stub

}

private boolean isRunning = false;

Object getContent;

@Override

public IBinder onBind(Intent intent) {

// TODO Auto-generated method stub

return null;

}

@Override

public void onCreate() {

super.onCreate();

}

@Override

public int onStartCommand(Intent intent, int flags, int startId) {

super.onStartCommand(intent, flags, startId);

// Announcement about starting

Toast.makeText(this, "Starting the Demo Service", Toast.LENGTH_SHORT)

.show();

// Start a Background thread

isRunning = true;

Thread backgroundThread = new Thread(new BackgroundThread());

backgroundThread.start();

// We want this service to continue running until it is explicitly

// stopped, so return sticky.

return START_STICKY;

}

@Override

public void onDestroy() {

super.onDestroy();

// Stop the Background thread

isRunning = false;

// Announcement about stopping

Toast.makeText(this, "Stopping the Demo Service", Toast.LENGTH_SHORT)

.show();

}

private class BackgroundThread implements Runnable {

int counter = 0;

public void run() {

try {

counter = 0;

while (isRunning) {

System.out.println("" + counter++);

new Contents().getAll(getResources(),

getApplicationContext());

Thread.currentThread().sleep(5000);

}

System.out.println("Background Thread is finished.........");

} catch (Exception e) {

e.printStackTrace();

}

}

}

在我的主要

Intent start = new Intent(".service.MoodyService");

this.startService(start);

并试过

Intent intent = new Intent(this, MoodyService.class);

this.startService(intent);

并尝试着全路径

android:name="com.example.moody.service.MoodyService"

android:icon="@drawable/ic_launcher"

android:label="@string/moody_service" >

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值