Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

Overview

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.svg) ![](https://img.shields.io/crates/l/rustc-serialize.svg) ![](https://img.shields.io/badge/version-1.0.0-blue.svg)

Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

You can report any issue on issues page. Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)

mediarecorderdialog

Installation


Maven

<dependency>
<groupId>net.alhazmy13.MediaRecorderDialog</groupId>
<artifactId>libary</artifactId>
<version>1.0.0</version>
</dependency>

Gradle

dependencies {
	compile 'net.alhazmy13.MediaRecorderDialog:libary:1.0.0'
}

Usage


 new MediaRecorderDialog.Builder(MainActivity.this)
    .setOutputFormat(MediaRecorderDialog.OutputFormat.MPEG_4)
    .setAudioEncoder(MediaRecorderDialog.AudioEncoder.AAC)
    .setTitle("Recording,,,")
    .setMessage("Press the button")
    .setOnSaveButtonClickListener(new OnSaveButtonClickListener() {
        @Override
        public void onSucceed(String path) {
            // Toast.makeText(MainActivity.this,path,Toast.LENGTH_SHORT).show();
        }
        @Override
        public void onFailure() {
            //Toast.makeText(MainActivity.this,"Failure",Toast.LENGTH_SHORT).show();
        }
    })
    .show();

Implement an OnSaveButtonClickListener

In order to receive the path of file, you will need to implement the OnSaveButtonClickListener interfaces.

    @Override
    public void onSucceed(String path) {
        //Your Code
    }
    @Override
    public void onFailure() {
        //Your Code
    }

Additional Options

  • setTitle You can change the title of Dialog
.setTitle("Recording,,,")
  • setMessage to change the message
.setMessage("Press the button")
  • setOutputFormat You can change the Output format by passing the format from MediaRecorderDialog.OutputFormat
.setOutputFormat(MediaRecorderDialog.OutputFormat.MPEG_4)
  • setAudioEncoder You can change the Encoder by passing the value from MediaRecorderDialog.AudioEncoder
.setAudioEncoder(MediaRecorderDialog.AudioEncoder.AAC)

Theme and style

You can theme the dialog by overwriting the color resources in your project.

    <color name="media_recorder_colorPrimary">#00796B</color>
    <color name="media_recorder_background">#009688</color>
    <color name="media_recorder_bar">#80CBC4</color>

Credits

License


Copyright (c) 2016 Abdullah Alhazmy

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
An Android Dialog Lib simplify customization.
An Android Dialog Lib simplify customization.

FlycoDialog-Master 中文版 An Android Dialog Lib simplify customization. Supprot 2.2+. Features [Built-in Dialog, convenient to use](#Built-in Dialog) [Ab

Android library to show
Android library to show "Rate this app" dialog

Android-RateThisApp Android-RateThisApp is an library to show "Rate this app" dialog. The library monitors the following status How many times is the

A simple file/ directory picker dialog for android
A simple file/ directory picker dialog for android

FileListerDialog FileListerDialog helps you to list and pick file/directory. Library is built for Android Getting Started Installing To use this libra

a quick custom android dialog project
a quick custom android dialog project

QustomDialog Qustom helps you make quick custom dialogs for Android. All this is, for the time being, is a way to make it easy to achieve the Holo loo

Android library that allows applications to add dialog-based slider widgets to their settings
Android library that allows applications to add dialog-based slider widgets to their settings

Android Slider Preference Library Overview Slider represents a float between 0.0 and 1.0 Access with SliderPreference.getValue() or SharedPreferences.

An Android library for displaying a dialog where it presents new features in the app.
An Android library for displaying a dialog where it presents new features in the app.

WhatIsNewDialog What is new dialog for Android is used for presenting new features in the the app. It can be used in the activity starts, from menu or

Android library to show
Android library to show "Rate this app" dialog

Android-RateThisApp Android-RateThisApp is an library to show "Rate this app" dialog. The library monitors the following status How many times is the

A simple library to show custom dialog with animation in android
A simple library to show custom dialog with animation in android

SmartDialog A simple library to show custom dialog in android Step 1. Add the JitPack repository to your build file allprojects { repositories {

AlertDialog - Explain about Alert Dialog in Android

AndroidTemplate I got a problem to create Android project with Java 11 and anoth

Comments
  • App is crashing!

    App is crashing!

    App is crashing while calling the MediaRecorderDialog. The reason of crashing is apparently the non-inflation of FloatingActionButton. But I am unable to find, as everything is fine. The library is there, it is linked as well. Can you figure out the root cause of this issue?

    Here is the crash log: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mowe.complain/net.alhazmy13.gota.GotaActivity}: android.view.InflateException: Binary XML file line #50: Error inflating class android.support.design.widget.FloatingActionButton at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2689) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) at android.app.ActivityThread.access$900(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5938) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

    help wanted 
    opened by yasirtahir 4
  • Error Record

    Error Record

    Fatal Exception: java.lang.IllegalStateException at android.media.MediaRecorder.start(MediaRecorder.java) at net.alhazmy13.mediarecorderdialog.SoundDialog.onSecondaryViewAppeared(SoundDialog.java:288) at com.truizlop.fabreveallayout.FABRevealLayout.notifyListener(FABRevealLayout.java:295) at com.truizlop.fabreveallayout.FABRevealLayout.swapViews(FABRevealLayout.java:287) at com.truizlop.fabreveallayout.FABRevealLayout.access$300(FABRevealLayout.java:36) at com.truizlop.fabreveallayout.FABRevealLayout$3.onAnimationEnd(FABRevealLayout.java:229) at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:552) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1209) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1449) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.-wrap2(Unknown Source) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:655) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

    opened by yaserNKM 0
  • التطبيق يغلق بعد الضغط على الزر عند دمجه بالتطبيق و عند تجربة المثال هذا ما يطلع

    التطبيق يغلق بعد الضغط على الزر عند دمجه بالتطبيق و عند تجربة المثال هذا ما يطلع

    03-28 13:43:35.034 2541-2561/net.alhazmy13.mediarecorderdialog E/Surface: getSlotFromBufferLocked: unknown buffer: 0xac1238f0 03-28 13:43:38.564 2541-2541/net.alhazmy13.mediarecorderdialog E/MediaRecorder: start called in an invalid state: 4 03-28 13:43:38.565 2541-2541/net.alhazmy13.mediarecorderdialog E/AndroidRuntime: FATAL EXCEPTION: main Process: net.alhazmy13.mediarecorderdialog, PID: 2541 java.lang.IllegalStateException at android.media.MediaRecorder.start(Native Method) at net.alhazmy13.mediarecorderdialog.SoundDialog.onSecondaryViewAppeared(SoundDialog.java:197) at com.truizlop.fabreveallayout.FABRevealLayout.notifyListener(FABRevealLayout.java:295) at com.truizlop.fabreveallayout.FABRevealLayout.swapViews(FABRevealLayout.java:287) at com.truizlop.fabreveallayout.FABRevealLayout.access$300(FABRevealLayout.java:36) at com.truizlop.fabreveallayout.FABRevealLayout$3.onAnimationEnd(FABRevealLayout.java:229) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239) at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)

           at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
                                                                                     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                                     at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                                     at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                                                     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                                     at android.os.Handler.handleCallback(Handler.java:739)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    
    opened by trikiano 0
Releases(1.0.0)
Owner
Abdullah Alhazmy
Addicted to learning | Sr. Software engineer | Founder @xpend | Co-Founder @Gwork-projects & @EmaanHq
Abdullah Alhazmy
Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

FancyGifDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ...

Shashank Singhal 522 Jan 2, 2023
Alert Dialog - You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment.

We show a warning message (Alert Dialog) to the user in many parts of our applications. You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment. Thanks to this extension, you can create a Dialog and call it in the Activity or Fragment you want and customize the component you want.

Gökmen Bayram 0 Jan 9, 2022
ionalert 1.3 1.6 Java Sweetalert, Dialog, Alert Dialog

ionalert - Android Alert Dialog A beautiful design Android Alert Dialog, alternative of Sweet Alert Dialog based on KAlertDialog using MaterialCompone

Excel Dwi Oktavianto 23 Sep 17, 2022
Awesome Dialog built with Jetpack Compose

Compose Awesome Dialog Library untuk Android Native yang menggunakan Jetpack Compose untuk toolkit UI nya. Compose Awesome Dialog ini menampilkan Dial

Farhan Roy 16 Nov 4, 2022
[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.

Deprecated Please use android.support.v7.app.AlertDialog of support-v7. AlertDialogPro Why AlertDialogPro? Theming Android's AlertDialog is not an eas

Feng Dai 468 Nov 10, 2022
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.

AlertDialog for Android, a beautiful and material alert dialog to use in your android app. Older verion of this library has been removed

Akshay Masram 124 Dec 28, 2022
Extremely useful library to validate EditText inputs whether by using just the validator for your custom view or using library's extremely resizable & customisable dialog

Extremely useful library for validating EditText inputs whether by using just the validator (OtpinVerification) for your custom view or using library's extremely resizable & customisable dialog (OtpinDialogCreator)

Ehma Ugbogo 17 Oct 25, 2022
SweetAlert for Android, a beautiful and clever alert dialog

Sweet Alert Dialog SweetAlert for Android, a beautiful and clever alert dialog 中文版 Inspired by JavaScript SweetAlert Demo Download ScreenShot Setup Th

书呆子 7.3k Dec 30, 2022
An beautiful and easy to use dialog library for Android

An beautiful and easy to use dialog library for Android

ShouHeng 22 Nov 8, 2022
Advanced dialog solution for android

DialogPlus Simple and advanced dialog solution. Uses normal view as dialog Provides expandable option Multiple positioning Built-in options for easy i

Orhan Obut 5k Dec 29, 2022