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? 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; }}

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:

  myActivity.runOnUiThread (New Runnabel } {Public runs zero () {onSectionAttached (num);}});   

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.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -