Simple Audio recorder app in Sketchware

1.  Switch on AppCompat and Design.

2. In main.xml, add two Buttons startBtn and stopBtn, and add two TextViews textview_message and textview_file.



3. Add a SpeechToText component (To add record audio permissions).

4. Add a String variable outputFile and add a custom variable of type MediaRecorder with name mediaRecorder.

5. In onCreate, add write string__to file path__ block (To add read and write external storage permissions). Then put following codes to define outputFile.


stopBtn.setEnabled(false);
File downloadsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String fileName = "recording_" + System.currentTimeMillis() + ".3gp";
File file = new File(downloadsDir, fileName);
outputFile = file.getAbsolutePath();

6. Create a More block startRecording and put following codes in it.


        try {
            mediaRecorder = new MediaRecorder();
            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
            mediaRecorder.setOutputFile(outputFile);
            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
            mediaRecorder.prepare();
            mediaRecorder.start();

            startBtn.setEnabled(false);
            stopBtn.setEnabled(true);

            textview_message.setText("Recording Started");
        } catch (IOException e) {
            textview_message.setText(e.toString());
}


7. Create another More block stopRecording and put following codes in it.


if (mediaRecorder != null) {
            mediaRecorder.stop();
            mediaRecorder.release();
            mediaRecorder = null;

            startBtn.setEnabled(true);
            stopBtn.setEnabled(false);
            textview_message.setText("Recording Stopped");
        }

8. In startBtn onClick event, use more block startRecording.


9. In stopBtn onClick event use more block stopRecording.


10. Save and run the project.



Comments

  1. Wondering how much it costs to build a mobile app in Australia this year? From simple MVPs to complex enterprise solutions, Sunrise Technologies breaks down the real pricing, timelines, and trends you need to know in 2025.
    app development cost Australia

    ReplyDelete
  2. In 2025, business success relies on smart digital solutions. Off-the-shelf software often falls short when it comes to customization, integration, and scalability. That’s why Perth businesses are turning to custom software developers to meet their evolving needs.
    Best App Developers Perth

    ReplyDelete
  3. Build sleek, scalable, and high-performing iOS apps with Sunrise Technologies. Our Sydney-based team delivers custom iPhone and iPad app solutions tailored to your business goals—combining innovative design with powerful functionality.iOS Mobile App Development Company Sydney

    ReplyDelete
  4. Turn your app vision into a reality with expert developers who understand your business goals. Discover our trusted Mobile app development company in Australia and take the first step towards digital success.

    ReplyDelete
  5. Wondering how much software development will cost in 2025? Get clarity on pricing models, hidden costs, and budget planning in our detailed A complete guide to the software development cost 2025. Start your project with confidence.

    ReplyDelete
  6. Looking for expert app developers in Brisbane? Our team delivers top-notch mobile apps with seamless UX and cutting-edge tech. Perfect for startups & enterprises! Get your free consultation now! App Developers Brisbane

    ReplyDelete
  7. Best AI Development Company in Australia
    Well said! Choosing the right AI development partner in Australia ensures your business gets tailored, scalable, and future-ready solutions powered by cutting-edge technology.

    ReplyDelete

Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

Creating a Drawing View in Sketchware

Retrieve contact list in Sketchware

How to enable upload from webview in Sketchware?

Create a full screen dialog with CropImageView