AndroidStudio中使用异常断点的方法

时间:2025-01-27 07:56:13
public class DatabindingIncludeActivity extends AppCompatActivity { public static void start(Context context) { Intent starter = new Intent(context, DatabindingIncludeActivity.class); context.startActivity(starter); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityDatabindingIncludeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_databinding_include); binding.includeTextview.tv.setText("I am a good man."); // 抛出一个 NPE. throw new NullPointerException(); } }