2016-12-07 11 views
0

下位バージョンのAndroid Mobileでコードを実行しているときにこのエラーが発生しています。この問題の解決方法を教えてください。私はこの問題を検索しますが、私は間違いを犯している正確な箇所を見つけませんでした。Android.Content.Res.Resources + NotFoundException:リソースID#0x7f03005e

[ERROR] FATAL UNHANDLED EXCEPTION:Android.Content.Res.Resources+NotFoundException: Resource ID #0x7f03005e 
End of managed Android.Content.Res.Resources+NotFoundException stack trace --- 
android.content.res.Resources$NotFoundException: Resource ID #0x7f03005e 
at android.content.res.Resources.getValue(Resources.java:1125) 
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2316) 
at android.content.res.Resources.getLayout(Resources.java:941) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:395) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at md5ec747b7423972841ddca33efeffb70b8.LoginActivity.n_onCreate(Native Method) 
at md5ec747b7423972841ddca33efeffb70b8.LoginActivity.onCreate(LoginActivity.java:32) 
at android.app.Activity.performCreate(Activity.java:5133) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2225) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2311) 
at android.app.ActivityThread.access$600(ActivityThread.java:149) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5214) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 
at dalvik.system.NativeStart.main(Native Method) 
In mgmain JNI_OnLoad 

はここで多くの変更を行う必要があります

protected override void OnCreate(Bundle savedInstanceState) 
    { 
     base.OnCreate(savedInstanceState); 
     //RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; 
     // Create your application here 
     SetContentView(Resource.Layout.Login); 
     getUser(); 
     //play background video 
     //videoView = FindViewById<VideoView>(Resource.Id.BackVideo); 

     IP_Address = FindViewById<EditText>(Resource.Id.IPAddress_Text); 
     Username_IV = FindViewById<EditText>(Resource.Id.UserName); 
     Password_IV = FindViewById<EditText>(Resource.Id.Password); 
     Remember = FindViewById<CheckBox>(Resource.Id.Rembember); 
     login = FindViewById<Button>(Resource.Id.Login); 
     //speech = new TextToSpeech(this, this); 
     IP_Address.Text = "192.168.x.xxx/Sample"; 
     login.Click += login_Click; 
     //login_Click(); 

     dialog = new ProgressDialog(this); 
     dialog.Indeterminate = true; 
     dialog.SetCanceledOnTouchOutside(false); 
     dialog.SetProgressStyle(ProgressDialogStyle.Spinner); 
     dialog.SetMessage("Authenticating..."); 


    } 
    async void login_Click(object sender, EventArgs e) 
    { 
     try { 
      HideKeyBoard(); 
     dialog.Show(); 

     var p = new Dictionary<string, string>(); 
     //speech.Speak("Authenticating", QueueMode.Flush, p); 
     if (IP_Address.Text.Length <= 0) 
     { 
      Toast.MakeText(this, "Please Enter IP Address", ToastLength.Long).Show(); 
      IP_Address.Focusable = true; 
      //speech.Speak("Please Enter Password", QueueMode.Flush, p); 
      dialog.Dismiss(); 
      return; 
     } 
     if (Username_IV.Text.Length <= 0) 
     { 
      Toast.MakeText(this, "Please Enter UserName", ToastLength.Long).Show(); 
      Username_IV.Focusable = true; 
      //speech.Speak("Please Enter UserName", QueueMode.Flush, p); 
      dialog.Dismiss(); 
      return; 
     } 
     if (Password_IV.Text.Length <= 0) 
     { 
      Toast.MakeText(this, "Please Enter Password", ToastLength.Long).Show(); 
      Password_IV.Focusable = true; 
      //speech.Speak("Please Enter Password", QueueMode.Flush, p); 
      dialog.Dismiss(); 
      return; 
     }   
     else 
     { 

      IPAddress = IP_Address.Text.Trim(); 
      string API = "http://" + IPAddress + "/api/Sample/LoginCheck?username=" + Username_IV.Text + "&password=" + this.Encrypt(Password_IV.Text) + ""; 
      HttpClient httpClient = new HttpClient(); 
      string dataResult = await httpClient.GetStringAsync(API); 
      if (Convert.ToBoolean(dataResult)) 
      { 
       Toast.MakeText(this, "Login Success", ToastLength.Long).Show(); 
       //speech.Speak("Log in Success", QueueMode.Flush,p);     
       dialog.Dismiss(); 
       rememberMe(); 
       StartActivity(typeof(HomeActivity)); 
      } 
      else 
      { 
       Toast.MakeText(this, "Login failed", ToastLength.Long).Show(); 

       //speech.Speak("Log in Failed Please Check Your Credentials", QueueMode.Flush, p); 
       dialog.Dismiss(); 
      } 
     } 
    } 
     catch (Exception ex) 
     { 
      Toast.MakeText(this, "Login failed", ToastLength.Long).Show(); 
      dialog.Dismiss(); 
     } 
    } 
+0

ここにコードを記入してください。 –

+0

私は自分のコードを投稿しました。 –

+0

この行でこの例外が発生しています。SetContentView(Resource.Layout.Login); –

答えて

0

私のコードです。私はあなたのコードをいくつかの変更に置き換え、あなたに応じて他の変更も行います。 UIのIDのように正しいはずです。

@override 
protected void OnCreate(Bundle savedInstanceState) 
    { 
     super.OnCreate(savedInstanceState); 
     //RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; 
     // Create your application here 
     setContentView(R.layout.Login); 
     getUser(); 
     //play background video 
     //videoView = FindViewById<VideoView>(Resource.Id.BackVideo); 

     IP_Address = (EditText)findViewById(R.id.IPAddress_Text); 
     Also edit other UI componenets Like this. 
} 
+0

なぜ両者は同じではないのですか?あなたは説明していただけますか? –

+0

同じエラーが発生していません。 –

+0

コード内のUIのすべてのIDを変更しましたか? –

関連する問題