2
こんにちは私はxamrianのネイティブとxamrianの両方の形式で書かれたアンドロイドのアプリケーションを持っています。System.ArgumentException:型パラメータ名:型がJava型から派生しない
System.ArgumentException: type Parameter name: Type is not derived from a java type.
ここにボタンがあるページのための私のコードがあります:私は、デバイス上でこれを実行し、クリックしてくださいしかしxamrianフォームユーザーのクリックが、この場合のbutton_1でボタンがあります私は、このエラーにより、次のクラッシュを取得ボタンとその上に:
using Android.App;
using Android.Content;
using Android.Views;
using Android.Widget;
using Android.OS;
using Xamarin.Forms.Platform.Android;
namespace ReadyMo.Droid
{
[Activity(Label = "ReadyMO", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivityHomeView : FormsApplicationActivity
{
Button button;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
//This is the button im having issues with!!!!!!
//Code That opens the Settings Activity
button = FindViewById<Button>(ReadyMo.Droid.Resource.Id.button_1);
button.Click += (sender, e) => {
// this is our Xamarin.Forms screen
StartActivity(typeof(SettingsView));
};
}
//Code That Opens The Tips Activity!
[Java.Interop.Export("Tips")] // The value found in android:onClick attribute.
public void btnOneClick1(View v) // Does not need to match value in above attribute.
{
StartActivity(typeof(Tips));
}
//Code That Opens The Contact Activity!
[Java.Interop.Export("contact")] // The value found in android:onClick attribute.
public void btnOneClick2(View v) // Does not need to match value in above attribute.
{
StartActivity(typeof(Contact));
}
//Code That Opens The Modot Activity!
[Java.Interop.Export("modot")] // The value found in android:onClick attribute.
public void btnOneClick3(View v) // Does not need to match value in above attribute.
{
StartActivity(typeof(Modot));
}
//Code That Opens The Weather Activity!
[Java.Interop.Export("wether")] // The value found in android:onClick attribute.
public void btnOneClick4(View v) // Does not need to match value in above attribute.
{
StartActivity(typeof(Weather));
}
//Code That sends a email to [email protected]
[Java.Interop.Export("email")] // The value found in android:onClick attribute.
public void btnOneClick5(View v) // Does not need to match value in above attribute.
{
var email = new Intent(Android.Content.Intent.ActionSend);
email.PutExtra(Android.Content.Intent.ExtraEmail, new string[] { "[email protected]" });
email.PutExtra(Android.Content.Intent.ExtraSubject, "SEMA");
email.PutExtra(Android.Content.Intent.ExtraText, "Sent Using The ReadyMO App");
email.SetType("message/rfc822");
StartActivity(email);
}
//Code That Opens Calls The State Emergency Management Agency !
[Java.Interop.Export("call")] // The value found in android:onClick attribute.
public void btnOneClick6(View v) // Does not need to match value in above attribute.
{
var uri = Android.Net.Uri.Parse("tel:5735269100");
var intent = new Intent(Intent.ActionDial, uri);
StartActivity(intent);
}
//Code That Opens The Fax Activity!
[Java.Interop.Export("fax")] // The value found in android:onClick attribute.
public void btnOneClick7(View v) // Does not need to match value in above attribute.
{
StartActivity(typeof(Fax));
}
}
}
何か助けが素晴らしいだろう!
ありがとうございます!
[Activity(Label = "ReadyMO", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivityHomeView : FormsApplicationActivity
{
へ:::)問題になってしまったものを
ネイティブで「新しいTypeToken(){}。getType()」のように使用してください。 –
Stepan Maksymovさん、返信してくれてありがとうございます。 :) – Phoneswapshop
@StepanMaksymovサービスを開始しようとするとXamarin.androidで同じ問題が発生します。答えにあなたのコメントを詳しく教えてください –