Commit de7b5205 authored by shohboz's avatar shohboz

binding add

parent 11a9c2e6
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/layout/activity_main.xml" value="0.22" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
......
......@@ -29,6 +29,9 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
......
......@@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="uz.ssd.mobiuz">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
......
package uz.ssd.mobiuz
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import uz.ssd.mobiuz.databinding.ActivityMainBinding
import java.lang.NullPointerException
class MainActivity : AppCompatActivity() {
private var _bn: ActivityMainBinding? = null
private val bn get() = _bn ?: throw NullPointerException("cannot inflate")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
_bn = ActivityMainBinding.inflate(layoutInflater)
setContentView(bn.root)
bn.button.setOnClickListener {
val intent = Intent(Intent.ACTION_CALL)
// intent.data = Uri.parse(Uri.parse("tel:" + "211") Uri.encode("#"))
startActivity(intent)
}
}
override fun onDestroy() {
_bn = null
super.onDestroy()
}
}
\ No newline at end of file
......@@ -6,10 +6,12 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:id="@+id/button"
android:paddingHorizontal="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment