• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't able to add textview to linearlayout

 
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope clean build didn't worked. I tried it
 
Brian Tkatch
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic