I am trying to add a text to the textview for which i have set the width as Wrap_content. I am trying to get the width of this textview. But its showing 0 in all the cases.
When are you calling this? Has it already been drawn to the screen?
It sounds like you are calling getWidth() too early.
getWidth()
You can also take a look at this question.