Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:54:34+00:00 2026-05-27T19:54:34+00:00

I’m wondering how to record voice using Mono for Android. I’ve seen various materials

  • 0

I’m wondering how to record voice using Mono for Android. I’ve seen various materials for recording voice under Android, but none of them seems to cover the Mono version topic.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:54:35+00:00Added an answer on May 27, 2026 at 7:54 pm

    Here is a basic example that uses the default audiorecorder and records audio to .3gp format.
    It has an activity with a couple of buttons and a textview that displays a timer as you record your audio.

    Activity (AudoRecorderActivity.cs):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    using Android.App;
    using Android.Content;
    using Android.OS;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using System.Timers;
    using System.Threading;
    
    namespace App.MonoDroid {
        [Activity (Label = "Record Audio")]
        public class AudioRecorderActivity : Activity {
            Button btnStart;
            Button btnStop;
            public TextView tvTime;
            private System.Timers.Timer tm;
            private TimeSpan m_offset;
            private DateTime m_startTime;
            private const string STOPWATCH_ZERO = "00:00:00";
            AudioRecorder rec;
            private string FileName;
            bool isStarted = false;
    
            protected override void OnCreate (Bundle bundle)
            {
                base.OnCreate (bundle);
                SetContentView (Resource.Layout.audiorecorder);
                btnStart = FindViewById<Button> (Resource.Id.btnStart);
                btnStart.Click += new EventHandler (btnStart_Click); 
                tvTime = FindViewById<TextView> (Resource.Id.tvTimer);
                btnStop = FindViewById<Button> (Resource.Id.btnStop);
                btnStop.Click += new EventHandler (btnStop_Click);
                m_offset = new TimeSpan (0);
                m_startTime = DateTime.Now;
                tvTime.SetText (STOPWATCH_ZERO, TextView.BufferType.Normal);
            }
    
            void btnStop_Click (object sender, EventArgs e)
            {
                this.Finish ();
            }
    
            void btnStart_Click (object sender, EventArgs e)
            {
              //Check if SD card is mounted
                if (Android.OS.Environment.ExternalStorageState.Equals (Android.OS.Environment.MediaMounted)) {
                    if (isStarted) {
                        tm.Stop ();
                        rec.Stop ();
                        rec = null;
                        Finish ();
                    }
                    else {
                        rec = new AudioRecorder (Android.OS.Environment.ExternalStorageDirectory.AbsolutePath
                        + "/Android/data/" + this.Application.PackageName, "audiotest.3gp");
                        m_offset = TimeSpan.Parse (tvTime.Text);
                        m_startTime = DateTime.Now;
                        tm = new System.Timers.Timer (1000.0);
                        tm.Elapsed += new ElapsedEventHandler (tm_Elapsed);
                        tm.Start ();
                        rec.Start ();
                        isStarted = true;
                        btnStart.Text = GetString ("Stop");
                    }
                }
            }
    
            protected override void OnPause ()
            {
                base.OnPause ();
                this.Save ();
            }
    
            void tm_Elapsed (object sender, ElapsedEventArgs e)
            {
                DisplayTime ();
            }
    
            private void DisplayTime ()
            {
                TimeSpan elapsed = (DateTime.Now - m_startTime) + m_offset;
                RunOnUiThread (() => tvTime.SetText (String.Format ("{0:00}:{1:00}:{2:00}", 
                    (int)elapsed.TotalHours, elapsed.Minutes, elapsed.Seconds), TextView.BufferType.Normal));
            }
    
            //Stop the activity from being rotated so that the timer/recording isn't stopped. 
            public override void OnConfigurationChanged (Android.Content.Res.Configuration newConfig)
            {
                base.OnConfigurationChanged (newConfig);
                SetRequestedOrientation ((Android.Content.PM.ScreenOrientation)this.RequestedOrientation);
            }
        }
    }
    

    Layout file (audiorecorder.axml):

    <?xml version="1.0" encoding="utf-8" ?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical"
    >
    
      <TextView
        android:id="@+id/tvTimer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="100px"
        android:gravity="center_horizontal"
        />
      <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:weightSum="100"
        android:orientation="horizontal"
        >
        <Button
          android:id="@+id/btnStart"
          android:text="@string/Start"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          />
        <Button
          android:id="@+id/btnStop"
          android:text="@string/CancelButton"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          />
      </LinearLayout>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.