2012-06-24 54 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);