Hopefully fixed a couple rare crashes

pull/14/head
Sam Bosley 11 years ago
parent 30b8ab67a8
commit 570d340eaf

@ -10,6 +10,7 @@ import java.io.IOException;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
@ -83,6 +84,12 @@ public class AsyncImageView extends greendroid.widget.AsyncImageView {
if (imageCacheInstance == null) {
synchronized(AsyncImageView.class) {
if (imageCacheInstance == null) {
try {
if (Looper.myLooper() == null)
Looper.prepare();
} catch (Exception e) {
// Ignore
}
imageCacheInstance = new ImageCache(ContextManager.getContext(), CompressFormat.JPEG, 85);
}
}

@ -94,7 +94,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi
@Override
public void onInit(int status) {
// status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR.
if (status == TextToSpeech.SUCCESS) {
if (status == TextToSpeech.SUCCESS && mTts != null) {
// Set preferred language to US english.
// Note that a language may not be available, and the result will indicate this.
int result = mTts.setLanguage(Locale.getDefault());

Loading…
Cancel
Save