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
runOnUiThread(new Runnable() { | |
public void run() { | |
//Your code is in 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
/* | |
This is a common problem, you can not reach the context first and therefore it is null. | |
What you need to do here is that if you use "ActivityName.this" instead of getApplicationContext(), | |
context etc. your problem will be resolved. | |
*/ | |
//For example Alert Dialog; | |
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this); //Activity name | |
alertDialog.setMessage("Test Messages"); | |
alertDialog.setPositiveButton("OK", listener); | |
AlertDialog alert = alertDialog.create(); |
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 { | |
... | |
defaultConfig { | |
multiDexEnabled true | |
... | |
} | |
} | |
dependencies { | |
// add dependency |
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
//For Kotlin | |
val inputManager:InputMethodManager =getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
inputManager.hideSoftInputFromWindow(currentFocus.windowToken, InputMethodManager.SHOW_FORCED) | |
//For Java | |
InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); | |
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.SHOW_FORCED); |
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
object MyService { | |
private val TIMEOUTOFSECOND = 15 | |
private val _instanceOfService: Service by lazy { setupHttpClient() } | |
fun on(): Service { | |
return _instanceOfService | |
} |
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
inline fun ViewManager.lottieAnimationView() = lottieAnimationView {} | |
inline fun ViewManager.lottieAnimationView(theme: Int = 0, init: LottieAnimationView.() -> Unit) = ankoView({ LottieAnimationView(it) }, theme, init) | |
//then use it | |
frameLayout { | |
lottieAnimationView() | |
} |
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
//for example my iframe's id is myframe and then write want to element in iframe that my element's name is myTable | |
$('#myframe').contents().find('#myTable'); |
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
//Remove All Empty Columns in the Entire Workbook | |
function removeEmptyColumns() { | |
var ss = SpreadsheetApp.getActive(); | |
var allsheets = ss.getSheets(); | |
for (var s in allsheets){ | |
var sheet=allsheets[s] | |
var maxColumns = sheet.getMaxColumns(); | |
var lastColumn = sheet.getLastColumn(); | |
if (maxColumns-lastColumn != 0){ | |
sheet.deleteColumns(lastColumn+1, maxColumns-lastColumn); |
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
SET @serial=0; | |
UPDATE table_name SET new_product_id = @serial := @serial+1 |
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
//if you only want to use within your restriction you use vetoable | |
var name by vetoable("adali") { property: KProperty<*>, oldValue, newValue -> | |
newValue.startsWith("A") | |
} | |
name = "umut" | |
// # : name = "adali" ->because name not startwith S so | |
name = "Adanalı" | |
// # : name = "adanali" -> that's it |
OlderNewer