-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
25 lines (21 loc) · 811 Bytes
/
Copy pathMainActivity.java
File metadata and controls
25 lines (21 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.lgmbrydan.uselessbutton;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button crashButton = findViewById(R.id.crashButton);
crashButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Simulate a crash by causing a null pointer exception
String crashString = null;
crashString.length(); // This will cause a NullPointerException
}
});
}
}