Mehedi Hassan Piash | Senior Software Engineer | Android | iOS | KMP | Ktor | Jetpack Compose | React-Native.

July 28, 2020

Corner radius in android view like map

July 28, 2020 Posted by Piash No comments
We can set the marginBottom of the card view in negative value.Margin should be same value as card radius. For Example, <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MianActivity"> <androidx.cardview.widget.CardView ...

July 22, 2020

How to call activity from a library module in android studio

July 22, 2020 Posted by Piash No comments
Java try { Intent myIntent = new Intent(this,Class.forName("com.mypackage.myMainActivity")); startActivity(myIntent ); } catch (ClassNotFoundException e) { e.printStackTrace(); ...

kotlin



val intent = Intent(this, Class.forName("com.mypackage.myMainActivity"))startActivity(intent) 


July 19, 2020

Api Call with architecture component [live data]

July 19, 2020 Posted by Piash No comments
- Add gradle dependency: def lifecycle_version = "2.2.0" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" // LiveData implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" // Lifecycles only (without ViewModel or LiveData) implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" implementation...

July 16, 2020

Retrofit api client with BasicAuthInterceptor

July 16, 2020 Posted by Piash No comments
import com.google.gson.GsonBuilder import okhttp3.* import okhttp3.logging.HttpLoggingInterceptor import okio.IOException import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import java.util.concurrent.TimeUnit object ApiClient { private val okHttpClient by lazy { OkHttpClient() } private val retrofit: Retrofit by lazy { val builder = Retrofit.Builder() ...