嗨,我开发了一个名为“特殊人路线跟踪器”的应用程序,它是为盲人开发的。在我的应用程序中,向用户提供了语音指令,但用户将按照应用程序的指示通过单击屏幕的某些部分来提供输入。现在我想从用户那里获取语音输入。请给出描述。
package com.example.routetracker;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Select_destination extends Activity implements OnClickListener{
Button close,main,about,texila,aslam_market,royal_son,comsat;
MediaPlayer mPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_destination);
mPlayer=MediaPlayer.create(this, R.raw.selectdestination);
mPlayer.start();
texila=(Button)findViewById(R.id.btn_texila);
texila.setOnClickListener(this);
aslam_market=(Button)findViewById(R.id.btn_aslam_market);
aslam_market.setOnClickListener(this);
royal_son=(Button)findViewById(R.id.btn_royal_son);
royal_son.setOnClickListener(this);
comsat=(Button)findViewById(R.id.btn_comsat_wah);
comsat.setOnClickListener(this);
main=(Button)findViewById(R.id.btn_main);
main.setOnClickListener(this);
about=(Button)findViewById(R.id.btn_about);
about.setOnClickListener(this);
close=(Button)findViewById(R.id.btn_close);
close.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.btn_texila:
mPlayer.stop();
Intent i=new Intent(Select_destination.this,Start_tracking.class);
i.putExtra("place", "1");
startActivity(i);
break;
case R.id.btn_aslam_market:
mPlayer.stop();
Intent j=new Intent(Select_destination.this,Start_tracking.class);
j.putExtra("place", "2");
startActivity(j);
break;
case R.id.btn_royal_son:
mPlayer.stop();
Intent k=new Intent(Select_destination.this,Start_tracking.class);
k.putExtra("place", "3");
startActivity(k);
break;
case R.id.btn_comsat_wah:
mPlayer.stop();
Intent l=new Intent(Select_destination.this,Start_tracking.class);
l.putExtra("place", "4");
startActivity(l);
break;
case R.id.btn_main:
mPlayer.stop();
Intent o=new Intent(Select_destination.this,MainActivity.class);
startActivity(o);
break;
case R.id.btn_about:
mPlayer.stop();
Intent e=new Intent(Select_destination.this,Sample.class);
startActivity(e);
break;
case R.id.btn_close:
mPlayer.stop();
System.exit(1);
}
}
}