-
-
Save geek-atif/07ea5e32fec058c1546410fa500227a4 to your computer and use it in GitHub Desktop.
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
package com.atifqamar.helloworldndk | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import com.atifqamar.helloworldndk.databinding.ActivityMainBinding | |
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
//call to a native method | |
binding.sampleText.text = helloWorld() | |
} | |
/** | |
* A native method that is implemented by the 'helloworldndk' native library, | |
* which is packaged with this application. | |
*/ | |
external fun helloWorld(): String | |
companion object { | |
// Used to load the 'helloworldndk' library on application startup. | |
init { | |
System.loadLibrary("helloworldndk") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment