Get the App
SLTechnology News&Howtos  ›  Development  › 

How to click on Android to record continuously, release the recording and change the picture with the decibels?

Shulou Source: shulou.com Published: 2022-06-03 02:37:38 10月03日 Update

This article is about how Android can click on continuous recording, release the end of recording and change the picture with decibel size. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

DIALOG implementation of displaying recording size

Public class VioceDomio {private Context mContext; private AlertDialog dialog; private AlertDialog.Builder adialogbuile; private ImageView vioce_show; public VioceDomio (Context mContext) {this.mContext=mContext;} public void showRecordingDialog () {adialogbuile = new AlertDialog.Builder (mContext, R.style.Theme_AudioDialog); LayoutInflater inflater = LayoutInflater.from (mContext); View view=inflater.inflate (R.layout.voiceroomchage.nulls) Vioce_show= (ImageView) view.findViewById (R.id.vioce_show); adialogbuile.setView (view); dialog = adialogbuile.create (); dialog.show (); dialog. GetWindow (). SetLayout (500,450);} public void HideRecordingDialog () {if (dialogically invalid null & & dialog.isShowing ()) {dialog.dismiss (); dialog=null }} public void ChangeRecordingDialog (double db) {/ / change the size according to the decibels of the recording if (db > = 1 & & db=19 & & db=19 & & db=38 & & db=57 & & db=76 & & db=95 & & db 1) db= 20 * Math.log10 (ratio); / / Log.d (TAG, decibel value: + db) / / mHandler.postDelayed (mUpdateMicStatusTimer, SPACE); Message msg=new Message (); msg.obj=db; mHandler.sendMessage (msg) ). Start ();} catch (Exception e) {e.printStackTrace () }} if (event.getAction () = = MotionEvent.ACTION_UP) {/ / if you release if (soundfile! = null & & soundfile.exists ()) {/ / stop recording try {mmedio.setOnErrorListener (null); mmedio.setOnInfoListener (null) Mmedio.setPreviewDisplay (null); mmedio.stop (); thend.interrupt (); / / timetask.cancel ();} catch (Exception e) {Log.i ("Exception", Log.getStackTraceString (e)) } mmedio.release (); mmedio=null; speak.setText ("hold down please speak!") ; String content= "; if (content.isEmpty ()) {viocedomio.HideRecordingDialog (); / / hide the recording flag Msg msg=new Msg (content,Msg.TYPE_SENT,Msg.TYPE_SENT_VOICE,Integer.toString (time_int), file_path); msg.setChattype (0) Msglist.add (msg); adapter.notifyDataSetChanged (); / / refresh the display msgListView.setSelection in listview (msglist.size ()-1) when there is a new message / / locate listview to the last line} return true;}}); Thank you for reading! On "Android how to click continuous recording, release the end of recording and achieve with the decibels of the size of the picture" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it for more people to see it!

Tags: Size picture content more article good practical one line button file article logo message status interface look knowledge thread page prepare Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Apple MySQL vpn