【正文】
//實(shí)現(xiàn)初始化界面淡出效果 ((MiDiMusicActivity) context).finish()。 ((musicArtist))。 private ArrayListMusicData setMusicDatas() { // TODO Autogenerated method stub Cursor cursor=(, musicdata, null, null, null)。 if(mTouchableIds != null){ for(int id : mTouchableIds){ 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 23 View view = findViewById(id)。 ListView android:id=+id/musiclist android:layout_height=fill_parent android:layout_width=fill_parent android:layout_marginLeft=6dp android:layout_marginRight=6dp android:cacheColorHint=00000000 android:divider=color/divider_color android:dividerHeight=1dp android:listSelector=drawable/selector_list_item android:layout_below=+id/relativeLayout1 /ListView 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 22 在歌曲播放列表 使用了 SlidingDrawer(滑動(dòng)式抽屜)這個(gè)控件, SlidingDrawer隱藏屏外的內(nèi)容,并允許用戶通過(guò) handle以顯示隱藏內(nèi)容 , 將播放控制界面放在了這個(gè)隱藏內(nèi)容中, 它可以垂直或水平滑動(dòng), 布局代碼實(shí)現(xiàn)如下所示。 第二張表 favourite 存放于自己創(chuàng)建的 數(shù)據(jù)庫(kù)中,用于存放用戶自己添加歌曲的信息 , 如表 所示。 本應(yīng)用對(duì)播放器的基本控制也全部得到了實(shí)現(xiàn),例如:暫停 、上一首、下一首和播放時(shí)間的同步顯示等,如圖 所示 播放器的基本控制功能用例圖分析。 經(jīng)濟(jì)可行性 本系統(tǒng)開(kāi)發(fā)經(jīng)費(fèi)在經(jīng)濟(jì)上是可以接受的,現(xiàn)在電腦 和手機(jī) 已經(jīng)普及, 而手機(jī)更是人人都擁有,而 Android 手機(jī)更是主流手機(jī) ,在市面上一般的 Android 系統(tǒng)手機(jī)的價(jià)錢都在千元左右,所示說(shuō)價(jià)錢并不是很昂貴 。但在 J2SE 發(fā)布后 , Java 的執(zhí)行速度有了大幅提升。SQLite 支持 NULL、 INTEGER 、 REAL 、 TEXT 和 BLOB 等 數(shù)據(jù)類型。 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 7 本應(yīng)用 MIDI 播放器對(duì)歌曲的控制全都做在了 Service 里,后續(xù)會(huì)詳細(xì)說(shuō)明。在一個(gè) Android 應(yīng)用中,用戶 界面是由 View 和 ViewGroup 對(duì)象構(gòu)建的。在后臺(tái)運(yùn)行時(shí),應(yīng)用程序可以生成通知以引起注意。 G1 問(wèn)世幾個(gè)月之后,隨后就發(fā)布了 Android Market,它使用戶可以瀏覽應(yīng)用程 序,并且可以將應(yīng)用程序直接下載到他們的手機(jī)上。 目前中國(guó)擁有世界上最大的手機(jī)用戶群,再加上 3G的推出對(duì)整個(gè)行業(yè)的巨大推動(dòng)作用,全世界所有大中小型手機(jī)制造商幾乎都在招聘 Android 工程師。 Android 系統(tǒng)也在不斷更新以滿足需求,因此手機(jī)多媒體技術(shù)的開(kāi)發(fā)也就不可避免稱為熱點(diǎn)。 關(guān)鍵詞: Android; Google;音樂(lè)播放器; Java;移動(dòng)互聯(lián)網(wǎng) 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) III Abstract With the ing of the era of 3G, some words can be heard more and more frequently, such as 3G, Android, iPhone, Google, Apple, Mobile phone software, Mobile development. As the 3G work’s largescale construction and the smart phone’s rapid popularization, mobile inter age has e with a smile. Since the issuance of the world’s first mercial mobile phone in 1983, the total number of global mobile phone users has been more than billion in the past less than 30 years. Consumers demand more and more mobile phone’s performance in business and entertainment, which has made mobile phone the portable terminal for business and entertainment day by day. Being motivated by hardware, users’ needs on mobile phone software’s function goes increasingly high. Android system is updating to satisfy the needs. Therefore, the development of mobile multimedia technology has inevitably bee the hot spot. Android is the open source mobile system published by Google in 20xx. For the reason that its openness is superior to other closed mobile system, anyone can rewrite all functions in the mobile system as he or she like, which has made more and more people pay attention to this operating system. This design is a music player using Java as the basic programming language, which is based on Android operating system and above version, and can be operated by the standard database SQLite that offered by Android system. Though this design is not big, it contents Android’s most programming technology. Its favorable user interface can conduce to the realization of its basic function in music controlling (start, pause, switching between up and down music, lyrics synchronized display) and play mode controlling (single play, single cycle, random play and all cycle). Besides, it also realizes the function in song including search, add, delete and so on. Key words: Android。 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 3 第二章 開(kāi)發(fā)工具 相關(guān)簡(jiǎn)介 Android 概述 Android 一 詞 本意是指“機(jī)器人”,當(dāng)然現(xiàn)在大家都知道它是 Google 推出的開(kāi)源手機(jī)操作系統(tǒng) 。 Android 系統(tǒng)具有如下 5 個(gè) 特點(diǎn): ? 開(kāi)放性。 Android 開(kāi)發(fā)技術(shù)簡(jiǎn)介 Android 支持使用 Java 作為編程語(yǔ)言來(lái)開(kāi)發(fā)應(yīng)用程序,而 Android 的 Java 開(kāi)發(fā)方面從接口到功能,都有層出不窮的變化。作為一個(gè)基類, View 類為 Widget 服務(wù), Widget 是一組用于繪制交互屏幕元素的完全實(shí)現(xiàn)子類。 SQLite 數(shù)據(jù)庫(kù)是 Hipp 用 C 語(yǔ)言編寫(xiě)的開(kāi)源嵌入式數(shù)據(jù)庫(kù),支持的數(shù)據(jù)庫(kù)大小是 2TB, SQLite 是一個(gè)開(kāi)源的關(guān)系數(shù)據(jù)庫(kù),可以存儲(chǔ)大量數(shù)據(jù),并且可以很容易的進(jìn)行增刪改 查。 Java 語(yǔ)言 介紹 Java 是一種簡(jiǎn)單的 、 跨平臺(tái)的 、 面向?qū)ο?的 、 分布式的 、結(jié)實(shí)的、 健壯的 、 安全的 、結(jié)構(gòu)的 、 中立的 、 可移植的 、 性能很優(yōu)異的多線程的 、 動(dòng)態(tài)的語(yǔ)言。 Sun 公司對(duì) Java 編程語(yǔ)言的解釋是: Java 編程語(yǔ)言是個(gè)簡(jiǎn)單、面向?qū)ο?、分布式、解釋性、健壯、安全與系統(tǒng)無(wú)關(guān)、可移植、高性能、多線程和動(dòng)態(tài)的語(yǔ)言。 只需搭建 Android 開(kāi)發(fā)必要的開(kāi)發(fā)環(huán)境就可以了,本應(yīng)用選擇的開(kāi)發(fā)工具 Eclispe+JDK+Android插件 ADT。 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 14 用 戶歌 曲 列 表 模 塊添 加 歌 曲刪 除 歌 曲搜 索 歌 曲播 放 列 表 歌 曲操 作 數(shù) 據(jù) 庫(kù) 圖 歌曲列表模塊用例圖 播放模式模塊分析 MIDI 音樂(lè)播放器播放模式模塊應(yīng)有的需求:循環(huán)播放、隨機(jī)播放、順序播放和單曲循環(huán)的開(kāi)啟與關(guān)閉,如圖 所示。 如果 數(shù)據(jù)庫(kù) 中有數(shù)據(jù),就可以對(duì) 數(shù)據(jù)庫(kù) 進(jìn)行 查詢 、添加和刪除操作,然后刷新列表信息,這一模塊的流程 如圖 所示。 if(() instanceof View){ parent = (View)()。amp。 int musicArtist=()。 ()。 Android 是利用 ContentProvider 作為內(nèi)容提供商, SQLiteOpenHelper 數(shù)據(jù)庫(kù)幫助類來(lái)進(jìn)行對(duì)數(shù)據(jù)庫(kù)的創(chuàng)建和操作。 bundle=new Bundle()。 i musicCount。 } Override public boolean onTouchEvent(MotionEvent event) { return (event)。 int x = (int)()。 雖然 Android 生成屏幕的方有三種(第二章已介紹),但是一般使用 xml文件配置生成,這里有必要說(shuō)一下,其實(shí) Android 界面的代碼編寫(xiě)有點(diǎn)像 HTML,添加框架 , 編寫(xiě) 代碼 ,生成控件。 內(nèi)蒙古科技大學(xué)畢業(yè)設(shè)計(jì)說(shuō)明書(shū)(畢業(yè)論文) 16 第四章 總體 設(shè)計(jì) 數(shù)據(jù)庫(kù)設(shè)計(jì) MIDI 音樂(lè)播放器使用的是 Android 系統(tǒng)內(nèi)置的 SQLite 數(shù)據(jù)庫(kù),對(duì)于 SQLite 數(shù)據(jù)庫(kù)的介紹詳見(jiàn) 節(jié) 。 在國(guó)內(nèi)三大運(yùn)營(yíng)商如火如荼的 3G 營(yíng)銷戰(zhàn)持續(xù)升溫,再加上 3G 的推出對(duì)整個(gè)行業(yè)的巨大推動(dòng)作用,無(wú)疑將引爆 3G手機(jī)開(kāi)發(fā)工程師這個(gè)黃金職位。 Google 已經(jīng)可以利用 Eclipse 為軟件研發(fā)人員提供一個(gè)成熟的編寫(xiě) Android 應(yīng)用的開(kāi)發(fā)環(huán)境。 Java 是一個(gè)純的面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言,它繼承了 C++語(yǔ)言面向?qū)ο蠹夹g(shù)的核心 , Java 舍棄了 C ++語(yǔ)言中容易引起錯(cuò)誤的指針(以引用取代)、運(yùn)算符重載( operator overloading)、 多重繼承(以接口取代)等特性,增加了垃圾回收 功能用于回收不再被引用的對(duì)象所占據(jù)的內(nèi)存空間,使得程 序員不用再為內(nèi)存管理而擔(dān)憂。 目前在 Android 系統(tǒng)中集成的是 SQLite3 版本, SQLite 不支持靜態(tài)數(shù)據(jù)類型,而是使用列關(guān)系。 Android 四大組件簡(jiǎn)介 本節(jié)介紹 Android 非常重要的幾個(gè)組件, Android 有四大組件: Activity、 Service、Broadcast Receiver、 Content Provider。 ? 文件則包含了該項(xiàng)目中所用的 Activity、 Service 等組件,它是一個(gè)功能清單文件。移動(dòng)設(shè)備上的應(yīng)用程序可以被替換或擴(kuò)展,即使是撥號(hào)程序或主屏幕這樣的核心組件。從軟件開(kāi)發(fā)的觀點(diǎn)看, Android 正處在開(kāi)源領(lǐng)域的中心位置。 設(shè)計(jì) 背景 及意義 現(xiàn)今社會(huì)生活緊張,而欣賞音樂(lè)是其中最好的舒緩壓力的方式之一,本項(xiàng)目的目的是開(kāi)發(fā)一個(gè)可以播放主流音樂(lè)文件格式的播放器,本設(shè)計(jì) 實(shí)現(xiàn) 主要功能是播放 Mp3 格式的音樂(lè)文件,并且能 夠控制播放、暫停、停止、上一