• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't able to add textview to linearlayout

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,I'm creating viewpager app. I don't know why my textview is not added to linearlayout. I've the same source code which is downloaded from internet and I created same as the source code but my app unfortunately force stopped automatically. See my comments then you could understand what I'm trying to say...

      

Above code execute successfully upto **colorsInActive** if I comment the **dotsLayout.removeAllViews()** then it'll execute upto **dots[i].setTextColor(colorsInActive[currentPage]);** and it stopped working when **dotsLayout.addView(dots[i]);** method executed

     


XML Layout

   

Please help me.Thanks in advance
  
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, it's not executing a line of code? Or commenting out lines causing unexplainable behavior?

When i see strange behavior like that, a clean build can help. It's worth the extra few minutes for the gradle build for what it fixes.
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope clean build didn't worked. I tried it
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish i could help, but i don't really know enough about these things. I have created an app that dynamically added items in a loop, where i learnt about addView() and the attributes object (a pain!), but i did not use removeAllViews(). Maybe i can suggest something to help though. You can decide if this is helpful or not.

If i were debugging this, i would use debug (and logs) to make sure the code was executing. I would also whittle the code down to the point where it worked, to find the line of code causing the issue. Especially as it is so easy to create a new project to test it out. (Close Studio, copy and paste the directory, open Studio.) Are you able to try something like this to pinpoint the line of code causing the issue?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic