How to call webservice from kotlin in android

Step 1:create new application on Android Studio 3.0 Create GUI  textView, button and progress bar Add some external library create kotlin data class define your webservice url in MainActivity.kt add internet uses permission your mainfest.xml fileMainActivity.kt package com.iotwebplanet.learn.myapplication1import android.os.Bundle import android.support.design.widget.FloatingActionButton import android.support.design.widget.Snackbar import android.support.v7.app.AppCompatActivity import android.support.v7.widget.Toolbar import android.util.Base64 import android.view.Menu import android.view.MenuItem import android.view.View import android.widget.Button import android.widget.TextView import java.net.HttpURLConnection import java.net.URL import android.os.StrictMode import android.widget.ProgressBar import com.beust.klaxon.* import com.github.salomonbrys.kotson.fromJson import com.google.gson.Gsonclass MainActivity : AppCompatActivity() {public fun parse(name: String):Unit { val cls = Parser::class.java ...

Read more...

Good bye findViewById() use Kotlin Android Extensions

Hi Developers as we always juggle with findViewById() in Android activity class . Some time we forget to typecast xml into Kotlin or java . So good news for Kotlin android developer.

Kotlin Android Extensions

Kotlin Android Extensions are another Kotlin plugin that is included in the regular one, and that will allow to recover/find views from Fragments, Activities,   and Views in an effective  way.see how easy it is ….Step 1.

Add Kotlin Android Extensions in Gradle (Project)

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' //this the main plugin And that’s...

Read more...