Screen is empty when running the app
f6v opened this issue · comments
I'm running project on SM-G900F, Android 5.0 and when app loads, the screen is empty, I don't see any data.
It is working for me. Could you please give more info? Can you see any errors in logcat or debug and discover where it's failing? Thanks!
Closing it as I never heard from the author of the issue again.
Okay. So, I started with the tutorial and everything has been going on fine not until I got to chapter 10 trying to implement the Asyn.
doAsync {
val result = RequestForecastCommand("94043").execute()
Log.e(javaClass.simpleName, result.toString()) <-- It doesn't get to this place at all
uiThread() {
Log.e(TAG, "I am here")
Log.e(javaClass.simpleName, result.toString())
forcast_list.adapter = ForcastListAdapter(result)
}
}
Then, I debugged further and checked the ForecastRequest.kt
file
class ForecastRequest(val zipCode: String) {
companion object {
private val APP_ID = "15646a06818f61f7b8d7823ca833e1ce"
private val URL = "http://api.openweathermap.org/data/2.5/" +
"forecast/daily?mode=json&units=metric&cnt=7"
private val COMPLETE_URL = "$URL&APPID=$APP_ID&q="
}
fun execute(): ForecastResult {
val forcastJsonStr = URL(COMPLETE_URL + zipCode).readText()
Log.e(javaClass.simpleName, forcastJsonStr)<-- This printed out a result
return Gson().fromJson(forcastJsonStr, ForecastResult::class.java)
}
}
I don't know why it's not throwing any error or any bug though. And should it be a Gson conversion error, at least I'm supposed to get an error right?