Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
679 views
in Technique[技术] by (71.8m points)

making a textview clickable in android

I am making an android application,I have 4 textviews namely ProductId,Title,description,image.I want when i click on each one of them product id should be displayed.I have a webservice for this.

Output of webservice is

vmsc>
<response code="0" message="Success"/>
?
<responsedata>
?
<productcategories>
?
<productcategory>
<id>1</id>
<title>Celebrities</title>
<description>Celebrities</description>
<image>
        </image>
</productcategory>
?
<productcategory>
<id>2</id>
<title>Music</title>
<description>Music</description>
<image>
        </image>
</productcategory>
?
<productcategory>
<id>3</id>
<title>Sports</title>
<description>Sports</description>
<image>
        </image>
</productcategory>
?
<productcategory>
<id>4</id>
<title>Fashion</title>
<description>Fashion</description>
<image>
        </image>
</productcategory>
?
<productcategory>
<id>5</id>
<title>Religion</title>
<description>Religion</description>
<image>
        </image>
</productcategory>
?
<productcategory>
<id>6</id>
<title>Others</title>
<description>Others</description>
<image>
        </image>
</productcategory>
</productcategories>
</responsedata>
</vmsc>

Thanks in advance Tushar

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
final TextView view = (TextView) findViewById(R.id.textview1);
view.setOnClickListener(new View.OnClickListener() {

  @Override
  public void onClick(View v) {
    // request your webservice here. Possible use of AsyncTask and ProgressDialog
    // show the result here - dialog or Toast
  }

});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...