2016-06-19 34 views
0

我的清單存在問題。當我嘗試打開第二個活動,我得到的錯誤android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.xxxxx.monapplication.APPLICATION.OWNERREGISTRATION }如何從其他活動打開包子文件夾中的活動?

找到婁我艙單的.xml包含

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xxxxx.monapplication" android:versionCode="1" android:versionName="1.0" > 
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" /> 
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > 
<activity android:name="com.xxxxx.monapplication.application.Accueil" > 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
</activity> 
<activity android:name="com.xxxxx.monapplication.application.OwnerRegistration" > 
    <intent-filter> 
     <action android:name="android.intent.action.APPLICATION.OWNERREGISTRATION" /> 
     <category android:name="android.intent.category.APPLICATION.DEFAULT" /> 
    </intent-filter> 
</activity> 

的我的代碼的一部分,打開第二個活動

btnMel.setOnClickListener(new View.OnClickListener() 
{ 
    @Override 
    public void onClick(View v) 
    { 
     Intent i = new Intent("com.xxxxx.monapplication.APPLICATION.OWNERREGISTRATION"); 
     startActivity(i); 
    } 
} 

請幫我找到錯誤。

+0

試那朵代碼..意圖myIntent =新意圖(YourActivity.this,OWNERREGISTRATION.class); startActivity(myIntent); –

+0

謝謝。它的工作 –

+0

B Aristide PLZ接受我的答案.... –

回答

0

您可以通過類名稱調用活動,然後將您的自定義意圖設置爲setAction。

private String YOUR_ACTION = "com.xxxxx.monapplication.APPLICATION.OWNERREGISTRATION" 

//uou can use this instead. 
//Intent i = new Intent(this /* caller context */, OwnerRegistration.class); 
Intent i = new Intent(); 
i.setAction(YOUR_ACTION); 
startActivity(i); 
+0

此線程可能與您的問題相關: [開始活動使用自定義操作](http://stackoverflow.com/questions/10921451/start-activity-using-定製動作) –

0

嘗試此代碼..

Intent myIntent = new Intent(YourActivity.this, OWNERREGISTRATION.class); startActivity(myIntent);