Pages

Wednesday, 19 March 2014

How to Create A Clicable Textview in the android application?

How to Create A Clicable Textview in the android application..??


For making textview clickable You masut have to change the properties from xml file as well as JAVA file also.
there are various methods are available
but this one is easiest.



Make the Clickable attrib. turn  to true.

                    <TextView
                    android:id="@+id/textView1"es in java
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content""
                    android:text="Demo"
                    android:linksClickable="true"
                    />

change ur textview as above.
then we've to make change in java file.

public void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
setContentView(R.layout.rn1);
TextView textview1 =(TextView)findViewById(R.id.textView9);
                textview1.setOnClickListener(buttonhandler);
}
   View.OnClickListener buttonhandler=new View.OnClickListener() 
   { 
public void onClick(View v) {
if(v.getId()==R.id.textView9)
    {
CopyReadAssets();   
    }
Now in this after clicking on Textview it will Open Function CopyReadAssets();


& YOU ARE DONE.

Keep in touch for more detais..

No comments:

Post a Comment