2011-11-21 3 views
0

활동이 예외가 아닙니다. 예외가 발생했습니다. SplashScreen 액티비티를 시작한 다음 컨트롤을 MainActivity으로 전달합니다.Android 액티비티를 찾을 수 없습니다. 오류가 있습니까?

여기 내 매니페스트 파일

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="se.copernicus.activity" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="5" /> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <application 
     android:icon="@drawable/icon" 
     android:label="@string/app_name" > 

     <activity 
      android:label="@string/app_name" 
      android:name=".SplashScreenActivity" > 
      <intent-filter > 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="se.copernicus.activity.MainActivity" > 
    </activity> 

     <activity 
      android:label="@string/second_activity" 
      android:name="se.copernicus.activity.Secondactivity" 
      android:theme="@android:style/Theme.NoTitleBar" > 
     </activity> 
    </application> 
</manifest> 

이것은 내가 처음에 시작하고 시작 화면 활동이다.

public class SplashScreenActivity extends Activity { 
protected boolean _active = true; 
protected int _splashTime = 5000; 
Intent intent = new Intent("se.copernicus.activity.MainActivity"); 
Thread splashTread = null; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    splashTread = new Thread() { 
     @Override 
     public void run() { 
      try { 
       int waited = 0; 
       Log.i("Coming here 1","Coming here 1"); 
       while(_active && (waited < _splashTime)) { 
        sleep(50); 
        Log.i("Coming here 2","Coming here 2"); 
        if(_active) { 
         waited += 50; 
         Log.i("Coming here 3","Coming here 3"); 
        } 
       } 
      } catch(InterruptedException e) { 
       // do nothing 
      } finally { 
       finish(); 
       Log.i("Coming here 4","Coming here 4"); 
       startActivity(intent); 

       Log.i("Coming here 5","Coming here 5"); 

       if(splashTread!= null){ 
        splashTread.stop(); 
        splashTread=null; 
       } 
      } 
     } 
    }; 
    splashTread.start(); 
} 
@Override 
public boolean onTouchEvent(MotionEvent event) { 
    if (event.getAction() == MotionEvent.ACTION_DOWN) { 
     _active = false; 
    } 
    return true; 
} 

}

내가 너무 오류를 확인 매니페스트 이중에서 활동, 패키지 이름을 선언했습니다. 그럼에도 불구하고이 오류가 나타납니다. 내가 실수 한 부분이 어디 있니?

오류 로그 :

E/AndroidRuntime(340): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=se.copernicus.activity.MainActivity } 
E/AndroidRuntime(340): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408) 
E/AndroidRuntime(340): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378) 
E/AndroidRuntime(340): at android.app.Activity.startActivityForResult(Activity.java:2827) 
E/AndroidRuntime(340): at android.app.Activity.startActivity(Activity.java:2933) 
E/AndroidRuntime(340): at se.copernicus.activity.SplashScreenActivity$1.run(SplashScreenActivity.java:41) 
+2

Plz은 당신의 오류 로그 ... – Ratan

+1

@Vinoth을 제공합니다. –

+0

안녕하세요 kool4u, Adil Soomro. 방금 오류 로그를 추가했습니다. – Vinoth

답변

2

하는 Intent(String) 문서에서 살펴 보자 :

public Intent (String action)

action ACTION_VIEW와 같은 의도 조치.


지금 당신이 코드 조각을 살펴 :

Intent intent = new Intent("se.copernicus.activity.MainActivity"); 

그것은 당신이 행동 "se.copernicus.activity.MainActivity"로 활동을 시작하려는 것을 말한다. 그러나 당신은 그것을 원하지 않습니다. 클래스 se.copernicus.activity.MainActivity의 활동을 시작하려고합니다. 이들은 서로 다른 두 가지입니다!


그리고 지금은 오류 메시지를 보면 :

No Activity found to handle Intent { act=se.copernicus.activity.MainActivity } 

주의 오류 메시지의 act 부분은, 그것은 Action을 의미합니다. 즉, Android는 액션 "se.copernicus.activity.MainActivity"에 대한 모든 활동을 해결할 수 없습니다. 이것은 단지 나의 이전의 점을 증명한다. 대신 작업으로 클래스 이름을 치료


, 당신은 빈 액션 값으로 올바른 Intent를 작성해야하지만, 올바른 Activity 클래스 이름 (더 정확하게 올바른 구성 요소 ID 포함).그래서 당신은 실제로 다른 Intent 생성자를 사용하여 Intent를 작성해야하며 완전 매니페스트 파일 :

Intent intent = new Intent(SplashScreenActivity.this, MainActivity.class); 
+0

멋진 설명 ... 나에게 의도를 더 잘 이해 시켰습니다. 감사합니다 inazaruk !! – Vinoth

+0

나는 "행동"이 오류에서 의미하는 것을 이해하지 못했다. – Vinoth

0

중 하나를 설정 menifest 응용 프로그램 태그 패키지 이름이나되는 SplashScreen 활동

0

어에 완전한 작업 이름을 지정합니다. 이런 식으로 해보십시오.

Intent intent = new Intent(SplashScreenActivity.this, MainActivity.class); 
startActivity(intent); 
+0

Sver를 시도했지만 작동하지 않았습니다. 오류가 발생했습니다. – Vinoth

1

그냥 마무리() UR 활동을 실행 한 후 활동 ...

finally { 

      Log.i("Coming here 4","Coming here 4"); 
      startActivity(intent); 
      finish(); 
      ...... 

}

관련 문제