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
// Close all previous activities | |
// https://stackoverflow.com/questions/6330260/finish-all-previous-activities | |
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | |
// 10-09-18 - Not working in App Lock. | |
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
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
// Source: https://stackoverflow.com/a/11079475 | |
// Add below code to styles.xml | |
<style name="noAnimTheme" parent="AppTheme.NoActionBar"> | |
<item name="android:windowAnimationStyle">@null</item> | |
</style> | |
// Set below theme for Activity in Manifest |
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
// See all the settings pages | |
// https://developer.android.com/reference/android/provider/Settings | |
try { | |
context.startActivity(new Intent(Settings.ACTION_FINGERPRINT_ENROLL)); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
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
KeyguardManager myKM = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE); | |
if( myKM.inKeyguardRestrictedInputMode()) { | |
// Phone is locked | |
return; | |
} |
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
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public String getForegroundApp(Context context) { | |
String currentApp = "NULL"; | |
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { | |
try { | |
Class.forName( "android.app.usage.UsageStatsManager" ); | |
UsageStatsManager usm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); | |
long time = System.currentTimeMillis(); | |
List<UsageStats> appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time); | |
if (appList != null && appList.size() > 0) { |
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
android:fillViewport="true" |
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
$('.xenForm').find('fieldset').each(function() { | |
$(this).find('input[value="delete"]').prop("checked", true); | |
}); |
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
String originalString = "This is Mstoic Blog"; | |
String reversedString = ""; | |
for (int i = 1; i <= originalString.length(); i++) { | |
reversedString += (originalString.charAt(originalString.length()-i)); | |
} | |
System.out.println("Reversed: " + reversedString); |
OlderNewer