2012-06-24 56 views
1

我有一个意图到另一个类,它所做的只是标记错误。 我正在使用一些代码,我从一个问题的答案我askedAndroid意图到其他类不工作

我的包的名称是:com.exercise.AndroidAlarmService

我试图调用类是:.Hello

下面就是我如何调用类,它的击打不工作。 我不是android专家,所以在初学者的条款解释将不胜感激。

Log.i("Service", "onStart() is called"); 
Intent callIntent = new Intent(Intent.ACTION_CALL); 
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
callIntent.setClassName("com.exercise.AndroidAlarmService", ".Hello"); 
startActivity(callIntent); 
+0

什么是活动.Hello包的名称? – MikeIsrael

回答

2

使用

callIntent.setClassName("com.exercise.AndroidAlarmService", 
       "com.exercise.AndroidAlarmService.Hello"); 

而不是

callIntent.setClassName("com.exercise.AndroidAlarmService", ".Hello"); 
1

Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.exercise.AndroidAlarmService", "com.exercise.AndroidAlarmService.Hello"); startActivity(intent);