android – How to call parent activity function from ASyncTask?-ThrowExceptions

Exception or error: setAccountAuthenticatorResult can be called from the Activity, which extends AccountAuthenticatorActivity. My activity extends that, but launches ASyncTask and hence this setAccountAuthenticatorResult should be called from ASyncTask (or, the result of ASyncTask should be passed back to the main thread). How to do it? What is wrong in the code below? AsyncTask<Uri, Void, …

Camera : setDisplayOrientation function is not working for Samsung Galaxy ACE with Android 2.3.6-ThrowExceptions

Exception or error: I was trying to create a simple camera application for research. I Read Android Camera Official Document and then started coding. so I did some steps to get it work 1.Added required permissions for Camera feature in app. 2.locked my activity to PORTRAIT mode only. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 3.Added several camera callbacks to get …

android – Convert RxJava Observables To Live Data With Kotlin Extension Functions-ThrowExceptions

Exception or error: I’ve been using alot of RxJava Observables converted to LiveData in my code using LiveDataReactiveStreams.fromPublisher() library. So I though of adding an extension function to the RxJava Observable to easily convert them to LiveData. These are my extension functions: fun <T> Flowable<T>.toLiveData() : LiveData<T> { return LiveDataReactiveStreams.fromPublisher(this) } fun <T> Observable<T>.toLiveData(backPressureStrategy: BackpressureStrategy) …

android – TextToSpeech : deprecated speak function in API Level 21-ThrowExceptions

Exception or error: I try to use a TextToSpeech in my app, String text = editText.getText().toString(); tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); But the function speak(String text, int queueMode, HashMap params) is deprecated in API Level 21. Instead of that, it is adviced to use speak(CharSequence text, int queueMode, Bundle params, String utteranceId). But I don’t know how …