Android studio 中的致命异常 startactivity

Fatal Exception startactivity in Android studio

我在 Android / Java 是全新的。我有一些项目学校,我有这个代码

```
package com.example.utsmobileprograming;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    EditText etinput;
    CheckBox ckkotak, cksegitiga;
    Button btkirim;
    //membuat variabel object tipe data Proses

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        etinput=(EditText) findViewById(R.id.editTextTextInput);
        ckkotak=(CheckBox) findViewById(R.id.checkBoxKotak);
        cksegitiga=(CheckBox) findViewById(R.id.checkBoxSegitiga);
        btkirim=(Button) findViewById(R.id.buttonKirim);

        btkirim.setOnClickListener(v -> {
            Intent intentbentuk = new Intent(getApplicationContext(), ActivityHasil.class);
            intentbentuk.putExtra("inputan", etinput.getText().toString());
            intentbentuk.putExtra("kotak", ckkotak.isChecked());
            intentbentuk.putExtra("segitiga", cksegitiga.isChecked());
            startActivity(intentbentuk);
        });
    }
}

```

但我没有发现我的错误,因为我在我的 android 工作室

中看到了这个日志
2022-05-14 03:28:34.002 6525-6525/com.example.utsmobileprograming E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.utsmobileprograming, PID: 6525
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.utsmobileprograming/com.example.utsmobileprograming.ActivityHasil}; have you declared this activity in your AndroidManifest.xml?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2065)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
        at android.app.Activity.startActivityForResult(Activity.java:5314)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
        at android.app.Activity.startActivityForResult(Activity.java:5272)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:583)
        at android.app.Activity.startActivity(Activity.java:5658)
        at android.app.Activity.startActivity(Activity.java:5611)
        at com.example.utsmobileprograming.MainActivity.lambda$onCreate[=12=]$com-example-utsmobileprograming-MainActivity(MainActivity.java:32)

如何解决这个问题? startActivity 是我的问题吗?

您必须将 ActivityHasil 添加到您的 AndroidManifest.xml 文件中,如下所示

<activity android:name="ActivityHasil" android:exported="false"/>