0% found this document useful (0 votes)
47 views6 pages

Tugas Multimedia Audio

This document summarizes the steps taken to create a multimedia audio project in Eclipse. It describes creating a raw folder in res to store audio files in mp3 format. It provides the XML and Java code used to display a play button and text, and play the audio file when the button is clicked. When completed, the app successfully played the audio file on button press.

Uploaded by

Dhiyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views6 pages

Tugas Multimedia Audio

This document summarizes the steps taken to create a multimedia audio project in Eclipse. It describes creating a raw folder in res to store audio files in mp3 format. It provides the XML and Java code used to display a play button and text, and play the audio file when the button is clicked. When completed, the app successfully played the audio file on button press.

Uploaded by

Dhiyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

LAPORAN PRAKTIKUM TUGAS SUKARELA PEMROGRAMAN

MOBILE-2 Multimedia Audio

NAMA : FATTAKHU KHOLISNA

NIM : 888740305170113
KELAS : SKA 17 A2

MATA KULIAH : PEMROGRAMAN MOBILE 2

Tugas!!!

Membuat Multimedia Audio.


“Langkah-langkah membuat project multimedia audio pada eclipse”

I. TAHAPAN

A. Langkah-langkah praktikum
1. Buat folder raw pada folder res dan isikan file audio dengan
format mp3.

2. Source code main_playing_audio.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:textSize="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:text="Memainkan Musik"></TextView>

<ImageButton android:id="@+id/putarMusik"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:src="@drawable/play"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="fill_parent"></ImageButton>
<TextView android:text=""
android:id="@+id/ket"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="15px"></TextView>
</LinearLayout>

3. Source code PlayingAudio.Java

package contoh.playingAudio;
import java.io.IOException;
import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
import contoh.playingAudio.R;

public class PlayingAudio extends Activity{


ImageButton mainkan;
TextView keterangan;
MediaPlayer mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playing_audio);

keterangan=(TextView)findViewById(R.id.ket);
keterangan.setText("Silakan klik tombol play");

mainkan=(ImageButton)findViewById(R.id.putarMusik);
mainkan.setOnClickListener(new OnClickListener(){
public void onClick(View arg0){
mainkan.setEnabled(false);
keterangan.setText("Tombol play tidak aktif");
go();
}
});
}
public void go(){
mp=MediaPlayer.create(PlayingAudio.this, R.raw.dynamite);
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
mp.setOnCompletionListener(new OnCompletionListener(){
public void onCompletion(MediaPlayer arg0){
mainkan.setEnabled(true);
keterangan.setText("Silakan klik tombol play");
}
});
}
}
B. Hasil pengujian program (menjalankan dan uji inputan)
1) Tampilan Awal program yang dibuat.

2) Tampilan Jika gambar play diklik maka file mp3 akan


dijalankan.

II. ANALISA DAN PEMBAHASAN [opsional]

1. PlayingAudio.java
Nama file pada folder raw harus kecil semua jika tidak maka project jadi
error.

III. KESIMPULAN [opsional]

1. Dalam mengerjakan tugas ini kita harus lebih teliti dengan codingnya,
Seperti Penggunaan titik, titik koma. Karena jika salah sedikit saja maka
akan terjadi error.
2. Gunakan file video dengan format mp3.

You might also like