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
// detecting class type | |
jclass anotherCalculatorType = env->FindClass("com/sass/jni_sample/AnotherCalculator"); | |
// allocating object based on our class type | |
jobject anotherCalculator = env->AllocObject(anotherCalculatorType); | |
// our desire method in our Kotlin code that we want to use | |
// formular for the input and output is : (input types) output type , | |
jmethodID powerOfTwoMethodID = env->GetMethodID(anotherCalculatorType, "powerOfTwo", "(I)I"); | |
// the result will be 2 * 2 | |
jint result = env->CallIntMethod(anotherCalculator, powerOfTwoMethodID, 2); |
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
class AnotherCalculator { | |
fun powerOfTwo(input: Int): Int = input * input | |
} |
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 { | |
// ... | |
externalNativeBuild { | |
cmake { | |
cppFlags += "" | |
} | |
} | |
} | |
// ... |
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
/** | |
* You can edit, run, and share this code. | |
* play.kotlinlang.org | |
*/ | |
fun main() { | |
val length = readLine()?.toIntOrNull() ?: 0 | |
val input = mutableListOf<Int>() | |
repeat(length) { |
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
/** | |
* You can edit, run, and share this code. | |
* play.kotlinlang.org | |
*/ | |
fun main() { | |
val length = readLine()?.toIntOrNull() ?: 0 | |
val input = mutableListOf<Int>() | |
repeat(length) { |
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
[ | |
{ | |
"title": "Pulp Fiction", | |
"imageUrl": "https://upload.wikimedia.org/wikipedia/en/3/3b/Pulp_Fiction_%281994%29_poster.jpg", | |
"actresses": ["Uma Thurman", "Mia Wallace", "John Travolta"] | |
}, | |
{ | |
"title": "The Matrix", | |
"imageUrl": "https://upload.wikimedia.org/wikipedia/en/c/c1/The_Matrix_Poster.jpg", | |
"actresses": ["Keanu Reeves", "Carrie-Anne Moss", "Laurence Fishburne"] |
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
{ | |
"response": [ | |
{ | |
"name" : "Solna", | |
"phoneNumber" : "084555300", | |
"address" : "Rättarvägen 3, 169 68 Solna" | |
}, | |
{ | |
"name" : "Kista", | |
"phoneNumber" : null, |
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
[ | |
{ | |
"username": "Ali, | |
"passwordHash": 46792755 | |
}, | |
{ | |
"username": "Yauheni, | |
"passwordHash": 1450575459 | |
}, | |
{ |
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
{ | |
"response": [ | |
{ | |
"id": 1, | |
"name": "Parking Spot 1", | |
"area": "SOLNA", | |
"description": "Description of Parking Spot 1", | |
"isActive": true, | |
"latitude": 55.8275, | |
"longitude": 14.5693 |
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
abstract class Animal(val name: String) { | |
fun move() { | |
// Imp | |
} | |
abstract fun eat() | |
} | |
class Bird (name: String) : Animal(name) { | |
NewerOlder