[Solved] android startActivity Nullpointer exception [closed]


DetailActivity is just that, an Activity. You cannot access methods in it as you would an object. The only way to do so is to make that method static and do DetailActivity.showHtml() but this is not recommended.

The other problem is that you are not creating that Activity properly. You need to start it as an intent like so:

Intent newIntent = new Intent(this, DetailActivity.class);
startActivity(newIntent);

Then you should either access that method in that activity, or pass the variables through in a bundle like so:

Bundle bundle = new Bundle();
bundle.putString("webAdd", string);
newIntent.putExtras(bundle);

You can then access this in the DetailActivity by doing the following:

Bundle bundle = this.getIntent().getExtras();
String newString = bundle.getString("webAdd");

I suggest reading up some tutorials on how Activies work however.

0

solved android startActivity Nullpointer exception [closed]