What is the use ?

  1. Let
var number: Int? = null     //initialize with some value for result
var result = number?.let { //lambda func with it:Int as param
var
square = it * it //'it' is copy of number
square //let will return last line
}

  1. lateinit (mutable)
  2. lazy (immutable)
lateinit var lateInitString: String
fun methodToExecute() {
lateInitString = "can be initialised from anywhere is lateinit"
lateInitString
= "variable can be reassigned any number of times"
}
val lazyString: String by lazy{
"must to initialise as lambda"
}
fun
methodToExecute()…


dependencies {
...
implementation 'com.android.installreferrer:installreferrer:1.1'
}

  1. To optimize Telescoping constructor.
  2. Build immutable object
  3. If field will increase in future we need not to edit all previous classes.
class Student {
int rollNumber;
String firstName;
String lastName;
String address;
String age;
String studentClass;

Student(int rollNumber, String firstName, String lastName…

  1. Make app whitelist



public interface LoginActivityMVP {
interface View {
String getFirstName();
String getLastName();
void showUserNotAvailable();
void showInputError();
void showUserSavedMessage();
void setFirstName(String firstName);
void setLastName(String lastName);
}

interface Presenter {
void setView(LoginActivityMVP.View view);
void loginButtonClicked();
void getCurrentUser();
}

interface Model {
void createUser(String firstName, String lastName);
User getUser();
}
}
public class LoginActivityPresenter implements LoginActivityMVP.Presenter {…

<receiver android:name="com.package.app.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>


  1. No Separation of concerns
  1. Well-separated layers
  2. Extensible and maintainable.

  1. A takes 2 minute to cross the bridge.
  2. B takes 3 minutes to cross the bridge.
  3. C takes 4 minutes to cross the bridge.
  4. D takes 7 minutes to cross the bridge.

Rahul Sharma

Lead Android Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store