Skip to content

Instantly share code, notes, and snippets.

View vengateshm's full-sized avatar
🏠
Working from home

Vengatesh M vengateshm

🏠
Working from home
View GitHub Profile
@vengateshm
vengateshm / AndroiJenkinsSetup.txt
Created March 14, 2024 15:04
Jenkins setup for Android app
Steps:
1. Clone
2. Build
3. Fortify Scan
4. Lint Test
5. Start Emulator
6. Unit Tests
7. Sonar Scan
8. Nexus IQ Scan
@vengateshm
vengateshm / AutoRefreshTimeText.kt
Last active January 17, 2024 08:18
Creating auto refresh time text composable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
@vengateshm
vengateshm / AndroidKotlinInterviewQuestions.md
Last active November 8, 2023 05:49
Android kotlin interview questions and answers

1. What is a memory leak?

When a computer program or application does not free up the memory which they allocated for performing an operation then memory leak occurs. Inner classes created inside activity hold implicit reference to activity object. If activity destroyed and inner class still in memory then it prevents activity object to be freed from memory causing a leak.

2. What is ANR in Android?

When UI thread is occupied for long time then Application Not Responding dialog pops up. Several reasons like network or database operation on UI thread, performing computationally intensive tasks in UI thread like complex mathematical calculation, bitmap manipulation can lead to ANR.

3. What is coroutine?

@vengateshm
vengateshm / CoreJavaInterviewQuestions.md
Last active November 7, 2023 05:17
Core Java Interview questions
  1. OOPs concepts Encapsulation, Abstraction, Inheritance, Polymorphism and explain
  2. Exception hierarchy in inheritance
  3. Parent child override scenario
  4. Can we override static and private method?
  5. Difference between Java 7 and Java 8 interface (static methods and default methods introduced)
  6. Final, Finally, Finalize
  7. Equals and hashcode
  8. Why checked exception also called compile time exception, is it occurs in compile time?
  9. How to write custom exception?
  10. Throw and throws exception
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@vengateshm
vengateshm / EdgeToEdgeActivity.kt
Last active October 6, 2023 18:09
Enable edge to edge
import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@vengateshm
vengateshm / SystemBarColorChangeActivity.kt
Created September 29, 2023 11:36
This code shows how to change status bar color and navigation bar color in jetpack compose.
import android.app.Activity
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.tween
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
@vengateshm
vengateshm / README.md
Created January 29, 2022 08:58 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@vengateshm
vengateshm / ReflectionUtils.java
Created October 22, 2021 06:06
Convert object to hashmap using reflection
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.IntFunction;
public class ReflectionUtils {