Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to fix the error that when I run my application it show me error the program crash and closed

In my application the in the MainActivity I have declared a button in click it must open LivePreviewActivity but the program is crash on that step also it gives an error in the logcat the line highlighted with blue"LivePreviewActivity.onCreate(LivePreviewActivity.java:55)" the line that has the error "setContentView(R.layout.activity_live_preview)"

In the MainActivity

btnstartcheck = findViewById(R.id.btn_Startcheck);
btnstartcheck.setOnClickListener(this);
@Override
public void onClick(View view) {
    Intent livepreviewIntent = new Intent(MainActivity.this, LivePreviewActivity.class);
    startActivity(livepreviewIntent);
}

In the LivePreviewActvity

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_live_preview);
}

In logcat

at com.fat7ifriends.moham.na2la.LivePreviewActivity.onCreate(LivePreviewActivity.java:84)

Comments