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
// Send ordered broadcast | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
// Create the intent for the ordered broadcast | |
val orderedBroadcastIntent = Intent("com.example.ORDERED_BROADCAST") | |
orderedBroadcastIntent.putExtra("message", "Hello from MainActivity!") |
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
// -----------------------------------------------------// | |
// CREATION OF SCHEMA | |
// -----------------------------------------------------// | |
CREATE TABLE IF NOT EXISTS user_permissions ( | |
id int NOT NULL, | |
permission_name varchar(50) NOT NULL, | |
PRIMARY KEY (id) | |
); |
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 PrivateKey getPrivateKey(String alias) throws UnrecoverableEntryException, NoSuchAlgorithmException, KeyStoreException { | |
//private key | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | |
return (PrivateKey) keyStore.getKey(alias, null); | |
} else { |
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
/** | |
* This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the |
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 File getCompressedFile(String filePath, Context context) { | |
int compressionRatio = 50; | |
float scaleDownFactor = 0.5f; | |
File inputFile = new File(filePath); | |
// by default it has same file reference as original one | |
// if create temp file fails it will have some file | |
File outputFile=new File(filePath); | |
try { |
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
public LRUCalculator{ | |
public static int getMemorySize(Context context){ | |
int memClass = ( ( ActivityManager )context.getSystemService( Context.ACTIVITY_SERVICE ) ).getMemoryClass(); | |
int cacheSize = 1024 * 1024 * memClass / 8; | |
return cacheSize; | |
} | |
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
/* | |
* Copyright (C) 2014 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
// declaration | |
public enum Season { | |
SPRING("Spring"), SUMMER("Summer"), FALL("Fall"), WINTER("Winter"); | |
private String name; | |
Season(String name) { | |
this.name = name; | |
} |
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
<ScrollView | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_weight="1" | |
android:fillViewport="true" | |
android:nestedScrollingEnabled="true"> | |
<android.support.constraint.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> |
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
-- https://stuff.mit.edu/afs/sipb/project/android/docs/google/play/expansion-files.html | |
-- http://sapandiwakar.in/how-to-set-up-android-app-to-support-expansion-files/ | |
-- https://stackoverflow.com/questions/18449680/setting-up-the-licensing-verification-library-on-android-studio | |
-- https://stackoverflow.com/questions/22368251/how-to-make-android-expansion-file-using-android-studio | |
-- https://stackoverflow.com/questions/18196067/the-import-com-google-android-vending-cannot-be-resolved-in-an-imported-android | |
-- https://github.com/bolein/better-apk-expansion |
NewerOlder