mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 05:12:40 +00:00
gaktau
add activty record
This commit is contained in:
parent
3ec9f88f4b
commit
e65dc75162
48
gaktau
Normal file
48
gaktau
Normal file
@ -0,0 +1,48 @@
|
||||
package com.blogspot.blogsetyaaji.androidlanjutan;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class SttActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.edTs)
|
||||
EditText edTs;
|
||||
@BindView(R.id.btnStt)
|
||||
Button btnStt;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_stt);
|
||||
ButterKnife.bind(this);
|
||||
}
|
||||
|
||||
@OnClick(R.id.btnStt)
|
||||
public void onViewClicked() {
|
||||
prosesSuara();
|
||||
}
|
||||
|
||||
private void prosesSuara() {
|
||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,new Locale("in","INA"));
|
||||
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,"Start Speak");
|
||||
|
||||
try {
|
||||
startActivity(intent, );
|
||||
}catch (Exception e){
|
||||
Toast.makeText(this, getString(R.string.tts_error), Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user