Reputation: 834
My activity is called CwiLogInActivity. I declare it in my Splash screen like so:
StartActivity(new Intent(Application.Context, typeof(CwiLogInActivity)));
error message:
Android.Content.ActivityNotFoundException: Unable to find explicit activity class {CwiMyCardApp.CwiMyCardApp/md5de4cbc02688eb358b61123b78d100d94.CwiLogInActivity}; have you declared this activity in your AndroidManifest.xml?
Android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="CwiMyCardApp.CwiMyCardApp" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="19" />
<application android:label="CwiMyCardApp">
<activity android:name=".CwiLogInActivity"/>
</application>
</manifest>
I am using cheeseknife to resolve my resources and I have no issues with compiling. I am getting my error at runtime.
CwiLogInActivity.cs
class CwiLogInActivity : AppCompatActivity
{
static readonly string TAG = "X:" + typeof(CwiLogInActivity).Name;
[InjectView(Resource.Id.loginName)]
EditText loginName;
[InjectView(Resource.Id.passWord)]
EditText passWord;
[InjectView(Resource.Id.loginButton)]
Button loginButton;
[InjectOnClick(Resource.Id.loginButton)]
void OnClickMyButton(object sender, EventArgs e)
{
// This code will run when the button is clicked ...
}
[InjectOnFocusChange(Resource.Id.loginName)]
void OnLoginFocusChange(View v, bool hasFocus)
{
if (hasFocus)
{
loginName.Text = "";
loginName.SetTextColor(Color.Argb(150, 000, 000, 000));
}
}
[InjectOnFocusChange(Resource.Id.loginName)]
void OnPasswordFocusChange(View v, bool hasFocus)
{
if (hasFocus)
{
passWord.Text = "";
loginName.SetTextColor(Color.Argb(150, 000, 000, 000));
}
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Log.Debug(TAG, "SplashActivity.OnCreate");
// Inflate the activity layout resource
SetContentView(Resource.Layout.LoginLayout);
// Use Cheeseknife to inject all attributed view
// fields and events. For an activity injection,
// simply pass in the reference to this activity.
Cheeseknife.Inject(this);
}
}
This seems to be in line with most of the solutions offered to other people who had my problem. Yet mine still persists.
Upvotes: 0
Views: 800
Reputation: 13176
You have no [Activity]
attribute defined on this activity. Thus it never gets injected in the AndroidManifest.xml
Upvotes: 2