編輯:關於android開發
View Code
package irdc.ex07_11;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaRecorder;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckedTextView;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class EX07_11 extends Activity
{
private ImageButton myButton1;
private ImageButton myButton2;
private ImageButton myButton3;
private ImageButton myButton4;
private ListView myListView1;
private String strTempFile = "ex07_11_";
private File myRecAudioFile;
private File myRecAudioDir;// 得到Sd卡path
private File myPlayFile;
private MediaRecorder mMediaRecorder01;
private ArrayList<String> recordFiles;
private ArrayAdapter<String> adapter;// 用於ListView的適配器
private TextView myTextView1;
private boolean sdCardExit;
private boolean isStopRecord;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//主要是4個控制按鈕(錄制,停止,播放,刪除)
myButton1 = (ImageButton) findViewById(R.id.ImageButton01);
myButton2 = (ImageButton) findViewById(R.id.ImageButton02);
myButton3 = (ImageButton) findViewById(R.id.ImageButton03);
myButton4 = (ImageButton) findViewById(R.id.ImageButton04);
//列表出指定文件夾中所有amr格式音頻文件
myListView1 = (ListView) findViewById(R.id.ListView01);
myTextView1 = (TextView) findViewById(R.id.TextView01);
myButton2.setEnabled(false);
myButton3.setEnabled(false);
myButton4.setEnabled(false);
布局文件main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/white">
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/record">
</ImageButton>
<ImageButton android:id="@+id/ImageButton02"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/stop">
</ImageButton>
<ImageButton android:id="@+id/ImageButton03"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/play">
</ImageButton>
<ImageButton android:id="@+id/ImageButton04"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/delete">
</ImageButton>
</LinearLayout>
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textColor="@drawable/black">
</TextView>
<ListView android:id="@+id/ListView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="@drawable/black">
</ListView>
</LinearLayout>
my_simple_list_item.xml文件:
1 <?xml version="1.0" encoding="utf-8"?>
2 <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:id="@+id/myCheckedTextView1" android:layout_width="fill_parent"
4 android:layout_height="fill_parent" android:textColor="@drawable/white" />
權限設置
<uses-permission android:name="android.permission.RECORD_AUDIO" />
關於jni編譯32位、64位動態庫(Android.mk和Application.mk文件),jniapplication.mk 最近新項目需要編譯64位的動
Android開發環境搭建,android開發搭建1.下載JDK,Eclipse、Android SDK、ADT插件 2.安裝JDK 通過配置JDK的變量環境,
ActionBar效果圖,功能一覽,actionbar效果圖一.概述 1.App icon 應用的圖標,左側帶應用相當於back返回鍵 2.ViewContr
ArcGIS for Android地圖控件的5大常見操作轉,arcgisandroidhttp://blog.csdn.net/arcgis_mobile/articl