+ 1
Okay so l make a code in Java but I want to output the result when I click the button using textToSpeech in a random way.
I just only want that whenever I click the button a voice say a random word from the list. https://code.sololearn.com/cLoW1z3j9JoT/?ref=app
9 Réponses
+ 1
hi ... I'm at work right now but...
for that you should use Android voice engine...
here check this out
https://code.tutsplus.com/tutorials/android-sdk-using-the-text-to-speech-engine--mobile-8540
+ 6
Pls give us your code..
so we can help you more..
+ 2
have u came up with any code?
if u have.. then send it so we can look at it and see what can be done......
+ 1
and if not ....
explain in more detail
+ 1
let us know if you get it done....
and if you had any problem I would love to try to help
+ 1
many thanks. 😺
0
this is my actual MainActivity.Java I have run the code Android studio & it says the code has 2 errors Idk if the toast pop-up is working cuz I'm having problems with the emulator.
https://code.sololearn.com/c4SAooEUoarJ/?ref=app
0
this one works perf. but I wanted to get the output using the voice
https://code.sololearn.com/cLoW1z3j9JoT/?ref=app
0
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="edu.inter.giva3477agu.appproject.MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/Btnpreg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="true"
android:onClick="btnClick"
android:text="@string/preguntar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="124dp" />
<LinearLayout
android:layout_width="368dp"
android:layout_height="231dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp">
<Button
android:id="@+id/verde"
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/holo_green_dark"
android:visibility="visible" />
<Button
android:id="@+id/btnrojo"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"