我的清单有问题。当我尝试打开第二个Activity时,收到错误android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.xxxxx.monapplication.APPLICATION.OWNERREGISTRATION }
查找我的Manifest .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 :(得分: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);
答案 1 :(得分:0)
试试这段代码..
Intent myIntent = new Intent(YourActivity.this, OWNERREGISTRATION.class); startActivity(myIntent);