Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report