last day (16 days later) » 

17:14
1
A: why retrofit giving an error in mainactivity?

rahatI just hit that API manually. Looks like the problem is here with receiving type MutableList<Quotes> apiInterface.getCurrencies().enqueue(object : Callback <CurrencyResponse> { override fun onResponse( call: Call<CurrencyResponse>, response: Response<Cu...

val currencyResponse = response.body() listUsers.clear() currencyResponse.let { listUsers.addAll(it)} adapter?.notifyDataSetChanged() } override fun onFailure(call: Call<CurrencyResponse>, t: Throwable) { hideProgressBar() Log.e("error", t.localizedMessage) } }) } } I am gettingerror here can you implemented whole mainactivity logic here
here what I have to declare private var listUsers: MutableList<Quotes> = mutableListOf<Quotes>()
your api gives a single object in response not a list
okay what is your suggestion then
can you help me implement network call correctly in mainactivity.kt and adapter class as well
you want a list of Quotes then ask the person at the API end to send json array of Quotes instead of one object
in adapter class I have to use CurrencyResponse class you mean right
it is object not array
17:14
{ "success": true, "terms": "currencylayer.com/terms", "privacy": "currencylayer.com/privacy", "timestamp": 1610813346, "source": "USD", "quotes": [ { "name":"USDAED", "value":3.673042 }, { "name":"USDAED", "value":3.673042 } ] }
hi rahat
yes
what is your suggestion bro I am a bit confused sorry
your name means enjoy in my language
you want a list of Quotes?
yes bro
17:16
Then the sample of json is for you
seee above
can I send my mainactivity and adapter code
no need
see the json above ask the person at api to send in this form
okay bro
I already have json api
then jsonschema2pojo.org this will help you to generate a java pojo
which you can convert to kotlin by studio
bro I already generate using json to kotlin
plugin
17:18
All the best
but now I need your guidance in mainactivity
and in adapter
I did not where I have to change in mainactivity
17:29
((((
I did not understand

  last day (16 days later) »