This will create following files
● MainActivity.kt with default generated code in Kotlin (which is why it has extension .kt)
● strings.xml that contains application strings (for Localization so that you don't hard code them)
● AndroidManifest.xml that contains application configuration
MainActivity.kt (generated code)
package com.example.testcompose
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Text
import androidx.compose.material.*
import androidx.compose.ui.platform.setContent
import androidx.ui.tooling.preview.Preview
import com.example.testcompose.ui.TestComposeTheme
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TestComposeTheme {
Surface(color = MaterialTheme.colors.background) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
TestComposeTheme {
Greeting("Android")
}
}
strings.xml
<resources>
<string name="app_name">TestCompose</string>
</resources>
Output