Mikrofon als Activity

This commit is contained in:
Julia Prölß 2023-06-07 13:39:57 +02:00
parent 1186473868
commit 5b920359a1
4 changed files with 17 additions and 9 deletions

View File

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.greenwatch">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"

View File

@ -2,7 +2,10 @@ package com.example.greenwatch;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@ -10,5 +13,13 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
((Button)findViewById(R.id.buttonstartmicdetection)).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this, Mikrofon.class);
startActivity(i);
}
});
}
}

View File

@ -1,4 +0,0 @@
package com.example.greenwatch;
public class Mikrofon {
}

View File

@ -6,13 +6,13 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
<Button
android:id="@+id/buttonstartmicdetection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:text="Starte Mikrofon Detection"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>