0

My question is I have a text lets say 15-20 lines which is taken from a TXT file . on the output screen if i click a specific word i should get a dialog with my own data..

for instance :

Realizing the importance of Distribution sector in the overall economical development of the country and improving the living standards of the citizens, Government of India and the State Governments are reforming the power sector for its economical revival and development. The objective of power sector reforms is for creating conditions for sustained development of its system through promotion of efficiency, transparency, quality of service and attracting private financing. The ultimate goal of the ongoing reform process is to ensure that

In the above example if i click any of that bold words i should get an alert box with my data( i ll write)to each bold word ..the total data(text) belongs to a single file and i am taking the above text from outside source ( txt file) .

pls help me to solve my request...

2 Answers2

0

You can do so by setting a on click listener on the textView .

You will have to create separate textviews for those words for which you want a dialog to appear on click

Refer to the following links:

How to click or tap on a TextView text

How to add click listeners into a string in Android/Java Textview?

How to set Listener for TextView?

Don't forget to add the following attribute in you textview

android:clickable="true"

Community
  • 1
  • 1
Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66
0

You can use Spannable.
http://developer.android.com/reference/android/text/Spannable.html

here is a handy tutorial to get you started
http://0xwalkingice.blogspot.in/2012/04/android-clickable-span-in-textview.html

oks16
  • 1,294
  • 11
  • 16