i am using following code in my app:
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.widget.TextView;
public class LinkifyDemo extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView linkify = (TextView) findViewById(R.id.linkify);
linkify.setText("http://www.google.com");
Linkify.addLinks(linkify, Linkify.WEB_URLS);
setContentView(R.layout.main);
}
}
also included followin permission in my manifest.
<uses-permission android:name="android.permission.INTERNET" />
But application giving error,getting force close.
Can any one help me in this.
Thanks!!
You can’t call
findViewById()before callingsetContentView(). Make thesetContentViewinvocation the first thing after thesupercall.