2016-12-07 2 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를 변경 했습니까? –

관련 문제