Wonderful problem-textview cannot get value

Source: Internet
Author: User

Problem Scenario

A few days ago to write an interface, encountered a very wonderful problem. The first time the app is installed, it's not going to happen when the user installs it for the first time. I was clearly assigned a textview of an interface, and the server returned the value, I debug, the line of code is running, but always return is null. I wonder why? I have been debugging several times ah, yes ah, what reason AH. Did I tease my sister today? Are you not handsome anymore? Am I being punished for stealing table snacks? No, no, it's not. Even if I really did the wicked thing, this code is right AH. I went on to look at the following code and found that the TextView was being assigned in multiple places, so that is the textview to get the values in different scenarios. I also found that the value is the same, is a telephone number. So why is it so many times that it is because the way to get the value is different from entering the page from the various entrances. And my scene is this: I go from page A to the C page, the TextView did get the value, but this textview in the following is assigned, this is the B page into the C page, and B page has not requested the server, its value is of course null. So the question is: Why not save the phone number and put it on SP or sqlite3 as a global value? Because the first time the app starts, some users may enter C from a, some users may enter C from B, the scene is different, so two places need to request the value of a phone number , I later to the back end of the classmate suggested that the number can be placed on the launch page that interface, because this interface is the most original and inevitable page. In this way, the backend does not have to store the number, convenient Yimeimei maintenance code, or will be curious, why should multiple places return phone number?

A little thought

I later made a careful summary: there are generally two situations that result in 1. The control is assigned multiple places, even if it is assigned a valid value, but is overwritten elsewhere. 2. Although there is a value, but unfortunately, to the other control assignment, that is, the control's ID is mistaken, there is pigtailed. Although the problem is very simple, but really careful. These are on the way to work, the evening record, take notes.

Wonderful problem-textview cannot get value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.