Skip to content

Instantly share code, notes, and snippets.

@GursheeshSingh
Created April 23, 2019 19:35
Show Gist options
  • Save GursheeshSingh/dd2fe9d5581dbda0e0e3cd9e961510d6 to your computer and use it in GitHub Desktop.
Save GursheeshSingh/dd2fe9d5581dbda0e0e3cd9e961510d6 to your computer and use it in GitHub Desktop.
public class InstanceFactory {
public static ILogger initLogger(){
return new FileLogger();
}
}
public class MainActivity extends AppCompatActivity {
private ILogger logger = InstanceFactory.initLogger();
@Override
protected void onCreate(Bundle savedInstanceState) {
logger.log("onCreate() starts");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logger.log("onCreate() ends");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment