diff --git a/app/src/main/java/org/ntlab/amaryllis/client/VoiceActivity.java b/app/src/main/java/org/ntlab/amaryllis/client/VoiceActivity.java
index 4b3b561..04154a1 100644
--- a/app/src/main/java/org/ntlab/amaryllis/client/VoiceActivity.java
+++ b/app/src/main/java/org/ntlab/amaryllis/client/VoiceActivity.java
@@ -1,4 +1,230 @@
package org.ntlab.amaryllis.client;
-class VoiceActivity {
-}
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.media.MediaPlayer;
+import android.media.MediaRecorder;
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import java.io.File;
+
+public class VoiceActivity extends AppCompatActivity {
+
+ private MediaRecorder mr;
+ private MediaPlayer mp;
+ static final String filePath = Environment.getExternalStorageDirectory() + "/app/res/raw";
+ private int totalTime;
+ private SeekBar positionBar;
+ private TextView elapsedTimeLabel;
+ private TextView remainingTimeLabel;
+ private int StartChange = 1;
+ File file;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ setContentView(R.layout.fragment_maps);
+ file = new File(getFilesDir(),"Sample.3gp");
+ mp = new MediaPlayer();
+
+
+
+ Button Record = (Button)findViewById(R.id.button);
+ Record.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View x){
+ TextView textView1 = (TextView)findViewById(R.id.Notice);
+ textView1.setText("Record Start!");
+ startRecord();
+ }
+ });
+
+ Button Playback = (Button)findViewById(R.id.button2);
+ Playback.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View x){
+ TextView textView1 = (TextView)findViewById(R.id.Notice);
+ textView1.setText("Playback Start!");
+
+ startPlay();
+ }
+ });
+
+ }
+
+
+
+ //public class mp extends Activity implements OnCompletionListener{
+
+ //};
+
+ //再生開始&再生中止
+ private void startPlay(){
+ ImageView Stoping = findViewById(R.id.Stoping);
+ ImageView Playing = findViewById(R.id.Playing);
+ float Tmin = 0;
+ float Tmax = 255;
+ //mp = new MediaPlayer();
+ //mp = MediaPlayer.create(this,R.raw.bgm);
+
+ if(mp.isPlaying()){
+ mp.stop();//再生を中断
+ //mp.pause();//途中から再生を再開したい時はこっちを使う必要があるかも
+ Stoping.setAlpha(1.0f);//画像が見えるようにする処理
+ Playing.setAlpha(0.0f);//画像が見えないようにする処理
+ //try{
+ //mp.prepare();
+ //}catch(IllegalStateException e){
+ //e.printStackTrace();
+ //}catch(IOException e){
+ //e.printStackTrace();
+ //}
+ }else {
+ try {
+ //mp = new MediaPlayer();
+ mp.setDataSource(file.getAbsolutePath());//再生するファイルを持ってくる
+
+ //OutputStream filePath = openFileOutput("a",MODE_PRIVATE);
+ //mp.setDataSource(filePath);
+ mp.prepare();
+ }catch(IllegalStateException e){
+ e.printStackTrace();
+
+ //if(StartChange == 1){
+ //positionBar = findViewById(R.id.positionBar);
+ //positionBar.setMax(totalTime);
+ //positionBar.setOnSeekBarChangeListener(
+ //new SeekBar.OnSeekBarChangeListener(){
+ //public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
+ //if(fromUser){
+ //mp.seekTo(progress);
+ //positionBar.setProgress(progress);
+ //}
+ //}
+
+ //public void onStartTrackingTouch(SeekBar seekBar){
+
+ //}
+
+ //public void onStopTrackingTouch(SeekBar seekBar){
+
+ //}
+ //}
+ //);
+
+ //}
+
+ //mp.start();
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ totalTime = mp.getDuration();
+ String S_totalTime = createTimeLabel(totalTime);//createTimeLabelにtotalTimeを渡す。
+ TextView voiceTime = (TextView)findViewById(R.id.VoiceTime);
+ voiceTime.setText(S_totalTime);
+ mp.seekTo(0);
+ mp.start();//再生スタート
+ Playing.setAlpha(1.0f);
+ Stoping.setAlpha(0.0f);
+ }
+ }
+
+ //totalTimeを分、秒に変換
+ public String createTimeLabel(int time){
+ String timeLabel = "";
+ int min = time/1000/60;
+ int sec = time/1000%60;
+
+ timeLabel = min + ":";
+ if(sec < 10) timeLabel += "0";
+ timeLabel += sec;
+ return timeLabel;
+ }
+
+ //録音開始&録音終了
+ private void startRecord(){
+
+ if(StartChange == 0) {
+ try {
+ mr.stop();
+ mr.reset();
+ mr.release();
+ StartChange = 1;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }else {
+ try {
+ mr = new MediaRecorder();
+ mr.setAudioSource(MediaRecorder.AudioSource.MIC);
+ mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
+ mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
+ mr.setOutputFile(file.getAbsolutePath());
+ //mr.setOutputFile(filePath);
+
+ mr.prepare();
+ mr.start();
+ StartChange = 0;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+
+ //private Handler handler = new Handler(){
+ //@Override
+ //public void handleMessage(Message msg){
+ //int currentPosition = msg.what;
+
+ //再生位置を更新
+ //positionBar.setProgress(currentPositon);
+
+ //経過時間ラベル更新
+ //String elapsedTime = createTimeLabel(currentPosition);
+ //elapseTimeLabel.setText(elapsedTime);
+
+ //残り時間ラベル更新
+ //String remainingTime = createTimeLabel(totalTime - currentPosition);
+ //remainingTimeLabel.setText("-" + remainingTime);
+ //}
+ //};
+
+
+
+ //再生停止
+ //private void stopPlay(){
+ //try{
+ //mp.stop();
+ //mp.prepare();
+ //mp.release();
+ //}catch(IllegalStateException e){
+ //e.printStackTrace();
+ //}catch(Exception e){
+ //e.printStackTrace();
+ //}
+ //}
+
+
+ //録音終了
+ //private void stopRecord(){
+ //try{
+ //mr.stop();
+ //mr.reset();
+ //mr.release();
+
+ //}catch(Exception e){
+ //e.printStackTrace();
+ //}
+ //}
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_maps.xml b/app/src/main/res/layout/fragment_maps.xml
index 7dbb416..962d67b 100644
--- a/app/src/main/res/layout/fragment_maps.xml
+++ b/app/src/main/res/layout/fragment_maps.xml
@@ -1,9 +1,73 @@
-
+ tools:context=".VoiceActivity">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file