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 RandomGenerator { | |
public RandomGenerator() { | |
} | |
public int getNumber() { | |
// generate a random number Random | |
r = new Random(); | |
return r.nextInt(); | |
} |
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 Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
RandomGenerator randomGenerator = new RandomGenerator(); | |
while(true) { | |
scanner.nextLine(); | |
int number = randomGenerator.getNumber(); | |
System.out.println(number); | |
} | |
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 OnNumberGeneratedListener { | |
void onNumberGenerated(int number); | |
} |
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 Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
RandomGenerator randomGenerator = new RandomGenerator(); | |
randomGenerator.setListener(new OnNumberGeneratedListener() { | |
@Override | |
public void onNumberGenerated(int number) { | |
System.out.println(number); |
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 RandomGenerator { | |
private OnNumberGeneratedListener listener; | |
public RandomGenerator() { | |
} | |
public OnNumberGeneratedListener getListener() { | |
return listener; | |
} |
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
try { | |
// throw exception | |
throwException(); | |
} catch (Exception e) { | |
// Crashlytics | |
Crashlytics.logException(e); | |
// Firebase Crash Reporting | |
FirebaseCrash.logcat(Log.ERROR, TAG, e.getMessage()); | |
FirebaseCrash.report(e); |
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
try { | |
// throw exception | |
throwException(); | |
} catch (Exception e) { | |
Timber.e(e.getMessage); | |
} |
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 App extends Application { | |
private static final String TAG = App.class.getSimpleName(); | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); |
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 | |
implements ForceUpdateChecker.OnUpdateNeededListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ForceUpdateChecker.with(this).onUpdateNeeded(this).check(); | |
} |
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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
ext.kotlin_version = '1.0.5' | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:2.2.2' | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
OlderNewer