Last active
April 23, 2019 18:45
-
-
Save GursheeshSingh/511122050ced2c5c50a2432dfce890de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DatabaseLogger implements ILogger { | |
@Override | |
public void log(String message) { | |
//Log to Database here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileLogger implements ILogger { | |
@Override | |
public void log(String message) { | |
//Log to File here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ILogger { | |
void log(String message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private ILogger logger = new FileLogger(); | |
@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