Correctly using let and use in Kotlin

Issue I am trying to convert the below code from Java to Kotlin. I am not sure if my solution is the cleanest solution. I would really appreciate help. Java (source: https://github.com/commonsguy/cw-omnibus/blob/v8.0/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java) @Override public void onImageAvailable(ImageReader reader) { final Image

Continue reading

Get just records count of a realtime database without retrieving all dates from database

Issue UPDATED My current code to get records count: commentRef.child(poi.Id).addListenerForSingleValueEvent(new ValueEventListener() { @SuppressLint("NotifyDataSetChanged") @Override public void onDataChange(@NonNull DataSnapshot snapshot) { commentList.clear(); setProgressDialog(); if (isAdded()) { counterValue = (int) snapshot.getChildrenCount(); setCounter(counterValue); } } This returns me the record count. If will

Continue reading

GSON throwing "Expected BEGIN_OBJECT but was BEGIN_ARRAY"?

Issue I’m trying to parse a JSON string like this one [ { “updated_at”:”2012-03-02 21:06:01″, “fetched_at”:”2012-03-02 21:28:37.728840″, “description”:null, “language”:null, “title”:”JOHN”, “url”:”http://rus.JOHN.JOHN/rss.php”, “icon_url”:null, “logo_url”:null, “id”:”4f4791da203d0c2d76000035″, “modified”:”2012-03-02 23:28:58.840076″ }, { “updated_at”:”2012-03-02 14:07:44″, “fetched_at”:”2012-03-02 21:28:37.033108″, “description”:null, “language”:null, “title”:”PETER”, “url”:”http://PETER.PETER.lv/rss.php”, “icon_url”:null, “logo_url”:null, “id”:”4f476f61203d0c2d89000253″, “modified”:”2012-03-02

Continue reading

Google Cloud TTS does not run Synchronously

Issue I am running Google Cloud TTS in my Android Studio project. My SpeechService class : public class SpeechService { private static final String TAG = SpeechService.class.getSimpleName(); private static final String ttsAPIUrl = "https://texttospeech.googleapis.com/v1/text:synthesize"; private static final String APIKey =

Continue reading