Close Menu
Techs Slash

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Younger Workers Are Rethinking Retirement Saving Earlier

    October 24, 2026

    Central Banks Walk a Narrow Path on Inflation and Growth

    October 24, 2026

    Ransomware Gangs Drop Encryption for Pure Data-Leak Extortion

    October 21, 2026
    Facebook X (Twitter) Instagram
    Techs Slash
    • Home
    • News
      • Tech
      • Crypto News
      • Cryptocurrency
    • Entertainment
      • Actors
      • ANGEL NUMBER
      • Baby Names
      • Beauty
      • beauty-fashion
      • facebook Bio
      • Fitness
      • Dubai Tour
    • Business
      • Business Names
    • Review
      • Software
      • Smartphones & Apps
    • CONTRIBUTION
    Facebook X (Twitter) Instagram
    Techs Slash
    Home»imran»Build an Audio or Sound Recorder Android App in Android Studio Using Java
    imran

    Build an Audio or Sound Recorder Android App in Android Studio Using Java

    Ranveer KumarBy Ranveer KumarOctober 19, 2022No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email

    Warning: Trying to access array offset on value of type bool in /home/cadesimu/techsslash.com/wp-content/themes/smart-mag/partials/single/featured.php on line 78
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Construct a Sound or Sound Recorder Android Application in Android Studio Utilizing Java Article has numerous implications. We will know this subject plainly through this article. We want to believe that you like this article.

    Build an Audio or Sound Recorder Android App in Android Studio Using Java

    package com.example.myaudiorecorder.myaudiorecorder;
    
    import android.Manifest;
    import android.content.pm.PackageManager;
    import android.media.MediaRecorder;
    import android.os.Environment;
    import android.support.v4.app.ActivityCompat;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    
    import java.io.File;
    
    public class MainActivity extends AppCompatActivity {
    
    MediaRecorder mediaRecorder;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PackageManager.PERMISSION_GRANTED);
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, PackageManager.PERMISSION_GRANTED);
    
    mediaRecorder = new MediaRecorder();
    }
    
    public void startRecording(View view){
    
    try {
    
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    
    File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    File file = new File(path, “/YouTubeAudio.3gp”);
    
    mediaRecorder.setOutputFile(file);
    mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    
    mediaRecorder.prepare();
    mediaRecorder.start();
    
    }
    catch (Exception e){
    e.printStackTrace();
    }
    }
    
    public void stopRecording(View view){
    
    mediaRecorder.stop();
    mediaRecorder.release();
    
    }
    
    }
    <?xml version=”1.0″ encoding=”utf-8″?>
    <manifest xmlns:android=”http://schemas.android.com/apk/res/android”
    package=”com.example.myaudiorecorder.myaudiorecorder”>
    
    <uses-permission android:name=”android.permission.RECORD_AUDIO”/>
    <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE”/>
    
    <application
    android:allowBackup=”true”
    android:icon=”@mipmap/ic_launcher”
    android:label=”@string/app_name”
    android:roundIcon=”@mipmap/ic_launcher_round”
    android:supportsRtl=”true”
    android:theme=”@style/AppTheme”>
    <activity android:name=”.MainActivity”>
    <intent-filter>
    <action android:name=”android.intent.action.MAIN” />
    
    <category android:name=”android.intent.category.LAUNCHER” />
    </intent-filter>
    </activity>
    </application>
    
    </manifest>
    <?xml version=”1.0″ encoding=”utf-8″?>
    <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”
    xmlns:app=”http://schemas.android.com/apk/res-auto”
    xmlns:tools=”http://schemas.android.com/tools”
    android:layout_width=”match_parent”
    android:layout_height=”match_parent”
    tools:context=”com.example.myaudiorecorder.myaudiorecorder.MainActivity”>
    
    <Button
    android:id=”@+id/button”
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:layout_alignParentStart=”true”
    android:layout_alignParentTop=”true”
    android:layout_marginStart=”129dp”
    android:layout_marginTop=”93dp”
    android:onClick=”startRecording”
    android:text=”@string/start” />
    
    <Button
    android:id=”@+id/button2″
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:layout_alignStart=”@+id/button”
    android:layout_below=”@+id/button”
    android:layout_marginTop=”146dp”
    android:onClick=”stopRecording”
    android:text=”@string/stop” />
    </RelativeLayout>

    Final Words

    Fabricate a Sound or Sound Recorder Android Application in Android Studio Utilizing Java We got to know our subject plainly. Furthermore, assuming that you feel somewhat uncertain about this article you can tell us your questions by means of remark.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Ranveer Kumar
    • Website

    Related Posts

    UFATHAI on Mobile: Accessing the Platform Across Your Devices

    October 13, 2026

    Legalne kasyno online Polska

    September 25, 2026

    Casinò senza AAMS attendibili: raccomandazioni per preservare la tua privacy e il tuo portafoglio

    September 25, 2026
    Leave A Reply Cancel Reply

    Top Posts

    On-Device AI: Why Your Next Phone Will Think Locally

    October 13, 2026

    Saturn Now Has 274 Moons After Astronomers Confirm 128 New Finds

    October 16, 2026

    AI Data Centre Spending Is Outpacing Revenue: What the Numbers Really Mean

    October 15, 2026

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    ABOUT TECHSSLASH

    Welcome to Techsslash! We're dedicated to providing you with the best of technology, finance, gaming, entertainment, lifestyle, health, and fitness news, all delivered with dependability.

    Our passion for tech and daily news drives us to create a booming online website where you can stay informed and entertained.

    Enjoy our content as much as we enjoy offering it to you

    Most Popular

    On-Device AI: Why Your Next Phone Will Think Locally

    October 13, 2026

    Saturn Now Has 274 Moons After Astronomers Confirm 128 New Finds

    October 16, 2026

    AI Data Centre Spending Is Outpacing Revenue: What the Numbers Really Mean

    October 15, 2026
    CONTACT DETAILS

    Phone: +92-302-743-9438
    Email: contact@serpinsight.com

    Our Recommendation

    Here are some helpfull links for our user. hopefully you liked it.

    Techs Slash
    Facebook X (Twitter) Instagram Pinterest
    • Home
    • About us
    • contact us
    • Affiliate Disclosure
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • Write for us
    © 2026 Techsslash. All Rights Reserved

    Type above and press Enter to search. Press Esc to cancel.

    WhatsApp us