Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just make application text to speech the application working fine, but more errors showing in logcat Can you tell me what is the solution ;

The main activity :

public class MainActivity extends Activity implements OnClickListener{


private ImageButton buttonPlayPause;
public EditText editTextSongURL;
private MediaPlayer player;
private Button rest;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initView();
}

/** This method initialise all the views in project*/
private void initView()
{
buttonPlayPause = (ImageButton)findViewById(R.id.ButtonTestPlayPause);
buttonPlayPause.setOnClickListener(this);
editTextSongURL = (EditText)findViewById(R.id.EditTextSongURL);
editTextSongURL.setText("hello");
rest = (Button)findViewById(R.id.rest);
rest.setOnClickListener(this);
}

@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.ButtonTestPlayPause:
String oLanguage = "en";
String mainText = editTextSongURL.getText().toString();
try
{
player.setDataSource("http://translate.google.com/translate_tts?tl=" + oLanguage + "&q=" + mainText);
player.prepare();
}
catch (Exception e){}
player.start();
break;
case R.id.rest:
player.reset();
break;
}
}
The main xml:

<linearlayout>xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical">

<edittext>
android:layout_height="wrap_content"
android:ems="10"
android:layout_width="wrap_content"
android:id="@+id/EditTextSongURL"/>

<ImageButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:id="@+id/ButtonTestPlayPause"/>

<Button
android:layout_height="wrap_content"
android:text="Button"
android:layout_width="wrap_content"
android:id="@+id/rest"/>
The logcat : The logcat show alot of this can you help
http://
i.stack.imgur.com/YTVFA.jpg
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900