This file contains hidden or 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
fun parseTime(value: String): String { | |
val dateTime = "2018-11-27 17:48:38.300" | |
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault()) | |
try { | |
val calendar = Calendar.getInstance() | |
calendar.time = format.parse(value) | |
var hour = calendar.get(Calendar.HOUR_OF_DAY) | |
val minute = calendar.get(Calendar.MINUTE) | |
val timeString: String |
This file contains hidden or 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
private static String uniqueID = null; | |
private static final String PREF_UNIQUE_ID = "PREF_UNIQUE_ID"; | |
public synchronized static String id(Context context) { | |
if (uniqueID == null) { | |
SharedPreferences sharedPrefs = context.getSharedPreferences( | |
PREF_UNIQUE_ID, Context.MODE_PRIVATE); | |
uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); | |
if (uniqueID == null) { | |
uniqueID = UUID.randomUUID().toString(); |
This file contains hidden or 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
private void createNotificationInOreo() { | |
String NOTIFICATION_CHANNEL_ID = "default"; | |
int id = (int) System.currentTimeMillis(); | |
Intent parentIntent = new Intent(this, ParentActivity.class); | |
Intent resultIntent = new Intent(this, SecondActivity.class); | |
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); | |
// Adds the back stack | |
stackBuilder.addParentStack(ParentActivity.class); |
NewerOlder