Android Question How To Use API Key

Sai Main Seng Kham

Member
Licensed User
hi, i am new in using API key and i have never done before

so, how can i use this api

{"exchange":{"bank_info":{"bank_name":"KBZ Bank","bank_logo":"https:\/\/logos-download.com\/wp-content\/uploads\/2016\/11\/KBZ_Bank_logo_symbol.png","bank_description":""},"exchange_data":[{"exchange_currency":"USD","exchange_rate_buy":"1505","exchange_rate_sell":"1512"},{"exchange_currency":"EUR","exchange_rate_buy":"1680","exchange_rate_sell":"1695"},{"exchange_currency":"SGD","exchange_rate_buy":"1095","exchange_rate_sell":"1111"},{"exchange_currency":"THB","exchange_rate_buy":"47.50","exchange_rate_sell":"49"}],"exchange_time":"18.07.2019"}}
To show like this
https://ibb.co/MBB5rJv


I got this API key and image from other developer .

The question is
How to display like that image with the API key Above ?

thanks u
 

Sai Main Seng Kham

Member
Licensed User
1. the images are broken
2. I did not understand the question. Can you describe it more clear?
3. I do not see any key in the jsonresult.
i dont even know how API key are .
but i want to know ,
the link below is the "Exchages Rate" of Dollar tht the developer from my country created.

http://kyawhtut.com/mmexchange/api

i want to create Exchange Rate Checker Application with B4A IDE.
So i decide to take this API and start create
I dont know how to start and where to start .
 

Sai Main Seng Kham

Member
Licensed User
My data string looks like
B4X:
{"exchange_data":[{"exchange_currency":"USD","exchange_rate_buy":"1505","exchange_rate_sell":"1512"},{"exchange_currency":"EUR","exchange_rate_buy":"1680","exchange_rate_sell":"1695"},{"exchange_currency":"SGD","exchange_rate_buy":"1095","exchange_rate_sell":"1111"},{"exchange_currency":"THB","exchange_rate_buy":"47.50","exchange_rate_sell":"49"}],"exchange_time":"18.07.2019"}}
and i coded like
B4X:
 Dim parser As JSONParser
    parser.Initialize("parser")
    Dim root As Map = parser.NextObject
    Dim exchange_time As String = root.Get("exchange_time")
    Dim exchange_data As List = root.Get("exchange_data")
    For Each colexchange_data As Map In exchange_data
        Dim exchange_rate_buy As String = colexchange_data.Get("exchange_rate_buy")
        Dim exchange_rate_sell As String = colexchange_data.Get("exchange_rate_sell")
        Dim exchange_currency As String = colexchange_data.Get("exchange_currency")
    Next

   Log(exchange_rate_buy)
   Log(exchange_rate_sell)
   Log(exchange_currency)
   Log(exchange_time)
And i get this error
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 357)
java.lang.RuntimeException: JSON Object expected.
    at anywheresoftware.b4a.objects.collections.JSONParser.NextObject(JSONParser.java:50)
    at s.example.main._activity_create(main.java:357)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at s.example.main.afterFirstLayout(main.java:104)
    at s.example.main.access$000(main.java:17)
    at s.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6810)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
 
Top