Skip to content

Instantly share code, notes, and snippets.

View mddhananjay's full-sized avatar

Dhananjay mddhananjay

View GitHub Profile
@mddhananjay
mddhananjay / Design patterns in android
Created September 2, 2016 17:44
Design patterns in android
The Following Android Classes uses Design Patterns
1) View Holder uses Singleton Design Pattern
2) Intent uses Factory Design Pattern
3) Adapter uses Adapter Design Pattern
4) Broadcast Receiver uses Observer Design Pattern
@mddhananjay
mddhananjay / Android Task Affinity
Created August 30, 2016 10:16
What is Android Task Affinity used for?
What is Android Task Affinity used for?
An android application has Activities that form a stack like a deck of cards. If you start an android application, and start five activities A,B,C,D,E. They will form a stack
E - chat view
D - weather screen
C - map view
B - weather screen
A - login screen
@mddhananjay
mddhananjay / Activity Launch Modes
Last active August 30, 2016 08:48
Activity Launch Modes
"standard" (the default mode)
Default. The system creates a new instance of the activity in the task from which it was started and routes the intent to it.
The activity can be instantiated multiple times, each instance can belong to different tasks, and one task can have multiple
instances.
"singleTop"
If an instance of the activity already exists at the top of the current task, the system routes the intent to that instance
through a call to its onNewIntent() method, rather than creating a new instance of the activity. The activity can be
instantiated multiple times, each instance can belong to different tasks, and one task can have multiple instances
(but only if the activity at the top of the back stack is not an existing instance of the activity).