如何使custome记录视图表?视图、custome

2023-09-07 11:11:47 作者:空了心还是忘了情

我想使custome观点计这为s preD当用户录制语音??

i want make custome view meter which is spred when the user record the voice??

有谁为录制音频知道的数字VU表的任何编码的例子吗?

Does anyone know of any coding examples of a digital VU Meter for recording audio?

有谁知道的用于显示正在录制的内容时,反馈任何编码的例子吗?

Does anyone know of any coding examples for showing feedback when a recording is being made?

推荐答案

这是一个Mediastore文件意味着录音。就像按一下按钮,开始记录

This is a Mediastore file means Audio Recording .just like click the button and start the recording

public class MediastoreActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
 Button btn = (Button)findViewById(R.id.recordBtn);
btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view) {
startRecording();
}});
}
public void startRecording() {
Intent intt = new Intent("android.provider.MediaStore.RECORD_SOUND");
startActivityForResult(intt, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case 0:
if (resultCode == RESULT_OK) {
 Uri recordedAudioPath = data.getData();
}
}
}
}

这是一个mail.xml文件中创建只有一个按钮

This is a mail.xml file create only one button

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:id="@+id/recordBtn"
android:text="Record Audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>