protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
f.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = "https://www.google.co.uk/";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
//This is what i have so far but it is not loading the URL on the emulator it keeps coming up with:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener((android.view.View$OnClickListener)' on a null object reference
I have tried most things and i cant figure it out for the life of me any help would be appreciated