Back to project page introToDroid4ed.
The source code is released under:
GNU General Public License
If you think the Android project introToDroid4ed listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.introtoandroid.viewsamples; /*from w ww .ja v a 2 s . com*/ import android.app.Activity; import android.os.Bundle; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.widget.TextView; public class TextDisplayActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text_display); TextView text = (TextView)findViewById(R.id.TextView02); registerForContextMenu(text); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub super.onCreateContextMenu(menu, v, menuInfo); if (((TextView)v).getLinksClickable()) { menu.add("Disable Clickability") ; } else { menu.add("Enable Clickability"); } } @Override public boolean onContextItemSelected(MenuItem item) { super.onContextItemSelected(item); TextView text = (TextView)findViewById(R.id.TextView02); if (text.getLinksClickable()) { //text.setLinksClickable(false); text.setMovementMethod(null); } else { text.setLinksClickable(true); text.setMovementMethod(new android.text.method.LinkMovementMethod()); } return true; } }