public class WypadekInformacjeActivity extends Activity {
TextView tv1;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.wypadek);
WebView webView = (WebView) findViewById(R.id.webView);
// webView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
webView.setBackgroundColor(0);
LoadText lt = new LoadText();
String html = lt.load(R.raw.wypadek, this);
webView.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);
Pattern pattern = Pattern.compile("\\d{3}?");
tv1 = (TextView) findViewById(R.id.textView1);
tv1.setAutoLinkMask(0);
// Linkify.addLinks(tv1, pattern, "tel: ");
// tv1.setAutoLinkMask(Linkify.PHONE_NUMBERS);
}
}
ERROR/AndroidRuntime(28184): FATAL EXCEPTION: main
...
Caused by: java.lang.NullPointerException at com.example.swubezpieczenia.WypadekInformacjeActivity.onCreate(WypadekInformacjeActivity.java:29)
It happens when when I try to setAutoLinkMask(0). This is line 29: "tv1.setAutoLinkMask(0);". When I comment this line there is no exception.