Android Question initialization confusion

67biscuits

Member
I need some assistance to understand the initialization process, as it seems I have misunderstood the process between a Layout and the main program code.
To make a long story short, I have rewritten a program to use .loadlayout method as opposed to incorporating a dozen panels that go invisible and visible when required. It works all right to a degree. As I was rebuilding the app though,, each time I tried to make reference to a (for example as I cannot get past this...) an edittext view (txtName), the app crashes due to a "txtName not initialized" error. If I initialize the view, txtName.initialize("txtName"), prior to setting the text value, it works, BUT, I then get a warning, saying that the txtName was created using the designer so I should not initialize it. But if I don't initialize it, it doesn't work, so what I have now is an initialization line prior to assigning the text property. Is that the correct way? It adds about 50 lines of code (so far)
What am I missing??

cheers
 

67biscuits

Member
Make sure to load the layout containing the Edittext before setting its value.

Without the layout loaded first (initialized), it will give such error
When you say it out loud it's so obvious...d'oh! That was the missing link. I was trying to load info into a 'background' layout. Now i load it only when the user wants to read the information.
Thanks mcqueccu
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…