java - Getting a error when changing a Android TextView visibility -
I have this code, do anyone know why I get an error when I compile it on my phone is? Edit: The error I get is incorrect on the test lines. Please attach the related log of your question the next time. It works very easy .. Anyway I can see in my code the only reasons for the error are: A. textView.setVisibility () is called from a thread other than the UI thread, if this is the case, do something to solve your problem: B. You did not say setContentView () in your layout before activating this code. C Your layout does not have a TextView element named TextView 1. In which situation, VivibId () Willow returns empty and textView.setVisibility () will result in NPE. Public Zero {Text View Textview = (Text View) Search on Content Attachment (Int Number) VubiID (RaidTextView1); TextView.setVisibility (View.VISIBLE); Switch (number) {case 1: mTitle = getString (R.string.title_section1); break; Case 2: mTitle = getString (R.string.title_section2); TextView.setVisibility (View.GONE); break; Case 3: mTitle = getString (R.string.title_section3); TextView.setVisibility (View.GONE); break; }}
myActivity.runOnUiThread (New Runnabel } {Public runs zero () {onSectionAttached (num);}});
Comments
Post a Comment