freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于android系統(tǒng)的音樂播放器設(shè)計與實現(xiàn)(編輯修改稿)

2025-01-09 01:01 本頁面
 

【文章內(nèi)容簡介】 安裝 ADT 按照 安裝完 SDK 初始包后,就可以開始開發(fā) Android 應(yīng)用程序了,但是為了更高效地進行開發(fā), Android 團隊推出了 Android Development Tools (ADT) 。 ADT 是目前開發(fā) Android 應(yīng)用最有效的工具,它是一個 Eclipse 插件,支持 Eclipse 及 以上的版本。以 Eclipse (Galileo)為例,安裝過程如下: Eclipse,選擇 Help Install New Softare。 Available Software 對話框中,點擊 Add...。 Add Site 對話框中,任意填寫一個名字到 Name 一欄。在 Location 一欄,則填入這一 URL :“ ” ,然后確認返回。(注意:如果在后續(xù)的步驟中發(fā)現(xiàn)無法安裝插件,可以試著把 URL 中的 換成。) Available Software 窗口后,就能看到列表中出現(xiàn)了 Developer Tools ,選中它前面的復(fù)選框,再點擊 “Next” ,就會開始下載安裝 ADT 的各種組件了。 ADT 相關(guān)的各種信息以及許可協(xié)議,點擊“Finish“ 即可完成安裝。 Eclipse。 設(shè)置 Eclipse Window Preferences... 打開偏好設(shè)置 Android一欄。 SDK Location 一欄邊的 Browse 按鈕,選擇剛剛下載的 SDK 保存的路徑。 Apply, OK,設(shè)置生效。 至此, Android 的開發(fā)環(huán)境就已經(jīng)搭建完畢,可以使用了 。 Android 模擬器中 sd 卡的創(chuàng)建 和文件的上傳 在 android 模擬器中,初始是沒有 sdcard 的,為了存放音樂文件,需要自己創(chuàng)建 sdcard, 我們先來看看如何創(chuàng)建 sdcard 以及文件上傳。 sd 卡的創(chuàng)建 : 通過 Android 的 Tools 來創(chuàng)建 sd 卡并導(dǎo)入進來 dos , windows+R 鍵打開。轉(zhuǎn)換到你的 sdk 安裝包的 tools 目錄下 , 如我的目錄如下: D:\Android\android sdk\tools sd 卡。在命令行中輸入:mksdcard 1024M D:\android\ 【這個 1024M 就是我們要創(chuàng)建的 SD 卡的大小,還是根據(jù)自 己的需要來輸入,最后面的那個 D:\android\ 就是我們所設(shè)置的 SD 存放路徑,這里也可以根據(jù)我們自己的需要改變路徑的,但要注意路徑中不能有空格出現(xiàn)】 eclipse 里面創(chuàng)建模擬器,并以該 sd 卡來創(chuàng)建 ,啟動該模擬器。可以在 Android SDK and AVD Manager 里面指定模擬器并啟動 eclipse 的 DDMS—— FileExplorer 看到如下的目錄結(jié)構(gòu) 證明已經(jīng)安裝 SD 卡成功了 。 向 sd 卡里面上傳文件 及異常解決 : 右 邊兩個小手機按鈕就是傳輸文件的按鈕了,用它來實現(xiàn)文件的傳入和傳出了,向做的表示把手機里的文件導(dǎo)出,向右的表示把文件導(dǎo)入到手機里面。 這里很容易出現(xiàn)異常。 異常如下: 異常一: Failed to push selection: Invalid argument 出現(xiàn)此異常,多半是文件所在的目錄里面有中文或者文件的名字是中文導(dǎo)致的。建議修改一下試試。還有就是觀察自己的操作權(quán)限是不是不夠,如果是:drwxrx 那就是可以的。如果, sd 卡是在 eclipse 里面系統(tǒng)自動創(chuàng)建的,試著重啟一下 IDE。 異常二 : Failed to push the item(s). 出現(xiàn)這個異常是因為,傳輸超時造成的??梢孕薷?。 打開 windows—— Preference—— android—— DDMS 把 ADB connection time out 項的超時時間改大點 。 4 音樂播放器詳細設(shè)計 播放器 界面說明 Android 的每一個可視化界面,都有其唯一的布局配置文件,該文件里面有各種布局方式,和各種資源文件如圖像,文字,顏色的引用,程序在運行時,可以通過代碼對個配置文件進行讀取。這樣就可以形成不同的 可視化界面和絢麗的效果。主界面布局文件內(nèi)容如下: ?xml version= encoding=utf8? AbsoluteLayout xmlns:android= android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/musicName android:layout_width=fill_parent android:layout_height=wrap_content / 此處一個 TextView用于顯示歌曲名稱 ,長和高均覆蓋內(nèi)容 ImageButton android:id=@+id/LastImageButton android:layout_width=wrap_content android:layout_height=wrap_content android:layout_x=10px android:layout_y=70px android:background=@drawable/last / 此處是上一首圖片按鈕, id為 LastImageButton,長和高均覆蓋內(nèi)容, x坐標為10px, y坐標為 70px,背景圖片為 drawable文件夾中的 last圖片 ImageButton android:id=@+id/StopImageButton android:layout_height=wrap_content android:layout_width=wrap_content android:layout_x=85px android:layout_y=70px android:background=@drawable/stop / 停止按鈕, 此處 同上 ImageButton android:id=@+id/playbtn android:layout_height=wrap_content android:layout_width=wrap_content android:layout_x=160px android:layout_y=70px android:background=@drawable/start / 播放按鈕,同上 ImageButton android:id=@+id/NextImageButton android:layout_width=wrap_content android:layout_height=wrap_content android:layout_x=235px android:layout_y=70px android:background=@drawable/next / 下一首按鈕,同上 TextView android:id=@+id/lrc android:layout_width=fill_parent android:gravity=center_horizontal android:layout_height=wrap_content android:layout_y=170dp / 此 TextView用于顯示歌詞,長和高覆 蓋內(nèi)容,居中, y坐標為 170dp SeekBar android:id=@+id/SeekBar01 android:layout_height=wrap_content android:layout_x=0dp android:layout_y=200dp android:layout_width=fill_parent android:max=100 android:progress=0 android:secondaryProgress=0 android:visibility=visible / 此 SeekBar表示進度條,長填充父容器,高覆蓋內(nèi)容, x坐標為 0dp, y坐標為 200dp, 最大值為 100,初始為 0,可見。 TextView android:layout_height=wrap_content android:layout_width=fill_parent android:layout_y=250dp android:id=@+id/currentProgress / 此 TextView用于顯示當前進度 ,長填充父容器,高覆蓋內(nèi)容, y坐標為 250dp TextView android:layout_height=wrap_content android:layout_width=fill_parent android:layout_y=300dp android:id=@+id/curtimeandtotaltime / 此 TextView用于顯示總時間, y坐標為 300dp /AbsoluteLayout Android 的媒體播放原理: Android 源程序 已經(jīng)為我們封裝了一個接口類,叫 MediaPlayer。該接口在執(zhí)行前需要一個數(shù)據(jù)源,通過如下四個步驟: 第一步: ();復(fù)位操作,為以后的媒體準備播放做準備。 第二步:傳入歌曲數(shù)據(jù)源,這里也是一個數(shù)據(jù)源 (String path);參數(shù)需要傳一個路徑,該接口類在收到路徑后將其轉(zhuǎn)化為數(shù)據(jù)源。 第三步:準備播放數(shù)據(jù)源,調(diào)用 (); 第四步: ();播放數(shù)據(jù)源,該數(shù) 據(jù)源播放后,不在于程序有關(guān),需要調(diào)用 ()方法讓其停止或 ();讓其啟動。 歌曲列表實現(xiàn)細節(jié) 在進入播放器之前,應(yīng)該先有個播放列表,將 sdcard 里的音樂文件列出來,供用戶選擇播放哪首。 這里用到了 ListActivity 類 。 ListActivity 類有 個重要的方法: setListAdapter()方法用于設(shè)置 ListAdapter 的列表項目 。 參數(shù)為繼承BaseAdapter 的類,可以自定義,也可以使用 Android 內(nèi)置的 Adapter。 Adapter相當于前臺列表顯示與后臺交互的橋梁。 內(nèi)置的 Adapter 有 3種: 只是 數(shù)據(jù)源不同而已 1. String[]: ArrayAdapter 2. ListMapString,?: SimpleAdapter 3. 數(shù)據(jù)庫 Cursor: SimpleCursorAdapter 這里我用的是自定義的 Adapter, MusicAdapter 繼承 BaseAdapter; 重寫父類方法: //*獲得游標對象的記錄數(shù)目 publc int getCount() { return ()。 } //得到位于 position處的對象 public Object getItem(int position) { return position。 } //得到位于 position處的 ItemId public long getItemId(int position) { return position。 } 最重要的 是 重寫 方法 public View getView(int position, View convertView, ViewGroup parent) //通過這個方法來設(shè)置列表顯示樣式。 public View getView(int position, View convertView, ViewGroup parent) { //給 convertView賦初值,使之從 musiclist這個 布局文件得到列表結(jié)構(gòu) convertView = (myCon).inflate(, null)。 //將游標對象移動到 position位置 (position)。 //獲得顯示歌曲名稱的 TextView TextView titleView = (TextView) convertView .findViewById()。 //從游標中取出歌曲名,然后將名稱顯示出來 ((0).trim())。 //獲得顯示作者的 TextView TextView artistView = (TextView) ()。 //獲得用于顯示持續(xù)時間的 TextView TextView durationView = (TextView) convertView .findViewById()。 //如果作者是 unknown,則設(shè)為未知藝術(shù)家。 if ((2).equals(unknown)) { (未知藝術(shù)家 )。 } else {
點擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1