Curated List of Real-time Android Interview Questions. Help fellow developers by contributing to these interview Questions - Create a pull request in Github.
Quick Jump to Topics:
public class RetainFragEgActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_my); | |
Button b = (Button) findViewById(R.id.aaa); | |
b.setOnClickListener(new View.OnClickListener() { | |
@Override public void onClick(View v) { |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
val array = readLine()!!.split(" ").map { it.toInt() }.toIntArray() // 1) Read the input and split into array | |
quickSort(array, 0, array.size-1) | |
for(i in array) println(i) | |
} | |
fun quickSort(array: IntArray, left: Int, right: Int) { | |
val index = partition (array, left, right) |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
var numSwaps = 0 | |
var isSorted = false | |
val str = readLine()!! | |
val intList: ArrayList<Int> = ArrayList(str.split(" ").map { it.toInt() }) //1) read values and convert them to arraylist | |
var lastUnsorted = intList.size - 1 // 2) to keep the track of unsorted array |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
val array = readLine()!!.split(" ").map { it.toInt() }.toIntArray() // 1) Read the input and split into array | |
mergeSort(array) | |
for(i in array) println(i) | |
} | |
fun mergeSort(array : IntArray, helper:IntArray = IntArray(array.size), low:Int = 0, high : Int = array.size-1) { | |
if(low < high) { |
fun main(args: Array<String>) { | |
val list = ArrayList(readLine()!!.split(" ").map { it.toInt() }) | |
selection(list) | |
for(i in list) println(i) | |
} | |
fun selection(a: ArrayList<Int>) { | |
var min:Int | |
for (i in 0 until a.size) { | |
min = i |
Quick Jump to Topics:
Button(this).run { | |
text = "Login" | |
background = ContextCompat.getDrawable(context,R.drawable.abc_btn_radio_material) | |
setOnClickListener { | |
openNextScreen() | |
} | |
} |
fun testScope(){ | |
var name = "Hi Vamsi" | |
run{ | |
var name = "Hello there" | |
println(name) //Hello there | |
} | |
println(name) // Hi Vamsi | |
} |
// Room | |
implementation "android.arch.persistence.room:runtime:1.0.0" | |
kapt "android.arch.persistence.room:compiler:1.0.0" |
package com.coderefer.androidtestingexamples | |
import kotlinx.android.synthetic.main.activity_main.* | |
import org.junit.Test | |
import org.junit.Assert.* | |
import org.junit.runner.RunWith | |
import org.robolectric.Robolectric | |
import org.robolectric.RobolectricTestRunner | |