Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old September 24th, 2012, 08:25 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Sep 2012
Gender: Male
Posts: 1
 
Device(s): Samsung Galaxy S3
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default App crashes when it starts, why?

Hi guys, I am new to android coding and today tried to finish my first app.
But whenever i start this app it crashes after about 5 seconds. I am quite desperate because I couldnt find the error/ mistake yet. Has anybody an idea what I did wrong?



Code:
package de.example.adorassprachausgabe;

import java.util.Locale;

import android.os.Bundle;
import android.app.Activity;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.view.View;


public class Sprachausgabe extends Activity implements OnInitListener{
	
	private TextToSpeech tts;
	
	
	/**Called when the activity is first created. */
	
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		tts = new TextToSpeech(this,this);
	
	}
	
	public void onInit(int arg0) {
		tts.setLanguage(Locale.GERMAN);
		Button sprich = (Button) findViewById(R.id.button1);
		sprich.setOnClickListener((OnClickListener) this);
	}
	
	public void onClick(View V){
		EditText et = (EditText) findViewById(R.id.editText1);
		tts.speak(et.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);
	}
}

xAdorasx is offline  
Reply With Quote
sponsored links
Old September 24th, 2012, 11:35 AM   #2 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,936
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 478 Times in 292 Posts
Default

I have never messed with TTS, but from looking at your logic, I don't see a problem. Can you post your logcat output?
jonbonazza is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:31 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.