RecycleView
RecyclerView.Adapter<T extends BaseAdapter>
RecyclerView.ViewHolder<T extends BaseViewHolder>
LinearLayoutManager
RecycleView
RecyclerView.Adapter
RecyclerView.ViewHolder<T extends BaseViewHolder>
LinearLayoutManager
RecycleView
RecyclerView.Adapter
RecyclerView.ViewHolder
LinearLayoutManager
RecycleView
RecyclerView.Adapter<VH extends ViewHolder>
RecyclerView.ViewHolder
LinearLayoutManager
Intent(this, NextActivity::class.java).also { intent ->
startActivity(intent)
}
Intent(this, NextActivity::class.java).apply {
put(EXTRA_NEXT, "some data")
}.also { intent ->
activityStart(intent)
}
Intent(this, NextActivity::class.java).apply {
putExtra(EXTRA_NEXT, "some data")
}.also { intent ->
startActivity(intent)
}
Intent(this, NextActivity::class.java).apply {
put(EXTRA_NEXT, "some data")
}.also { intent ->
activityStart(intent)
}
build.gradle में: include ':app',':about' ':settings'settings.gradle में: include ':app',':about' ':settings'settings.gradle में: include ':about',':settings'gradle.properties में: include ':app',':about' ':settings' defaultConfig {
...
minApiVersion 21
targetApiVersion 28
}
defaultConfig {
...
targetSdkVersion 21
testSdkVersion 28
}
defaultConfig {
...
minSdkVersion 21
testApiVersion 28
}
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
}
private lateinit var textView: TextView
override fun onCreateView(...): View? {
val root = inflator.inflator(R>layout.fragment_home, container, false)
textView = ??
return root
}
नोट: AndroidJUnitRunner हमें Android Devices पर JUnit3/4-style tests run करने देता है
व्याख्या: Method "getDefaultSharedPrefarances(this).getString()" में दूसरा parameter pass किया जाता है ताकि यदि key exist नहीं करती है तो उसे return किया जा सके। इसलिए हमें एक empty string pass करनी होगी जो key exist न होने की स्थिति में return हो।

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="4dp"
android:color="@android:color/white" />
<solid android:color="@android:color/black" />
</shape>
<oval xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="4dp" android:color="@android:color/black"/>
<solid android:color="@android:color/white"/>
</oval>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="4dp"
android:color="@android:color/black" />
<solid android:color="@android:color/white" />
</shape>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="4dp"
android:color="@android:color/white" />
<solid android:color="@android:color/white" />
</shape>
<merge/><include/><layout/><add/>android.permission.ACCESS_NETWORK_STATE
LinearLayout से सबसे अच्छी तरह correspond करती है? <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>




val dialerIntent = Intent()
val et = findViewById(R.id.some_edit_text)
dialerIntent.action = Intent.ACTION_DIAL
dialerIntent.data = Uri.parse("tel:" + et.getText()?.toString())
startActivity(dialerIntent)
Intent.ACTION_DIAL का उपयोग करते समय startActivity() के बजाय startActivityWithResult() का उपयोग किया जाना चाहिएIntent.ACTION_DIAL के लिए, इस dialerIntent का उपयोग करते समय Intent option Intent.FLAG_ACTIVITY_NEW_TASK जोड़ा जाना चाहिएdialerIntent उन devices पर ActivityNotFoundException throw करेगा जो Intent.ACTION_DIAL को support नहीं करते हैंIntent.ACTION_DIAL का उपयोग करने से पहले permission android.permission.CALL_PHONE request की जानी चाहिए/assets directory में files कब store करनी चाहिए?resource ID के साथ file तक access की आवश्यकता हो, जैसे R.assets.filenameResources.openRawResource() का उपयोग करके file को उसके raw form में access करने की आवश्यकता होintent बनाने का कौन सा लाभ नहीं है?intent को handle करने वाला app आपके design choices का सम्मान करेगाintent को handle करने वाला app UI provide करेगाActivityCompat.shouldShowRequestPermissionRationale() function का उपयोग कब करेंगे?release builds में analytics tracking enable करना चाहेंगे। उस value को store करने के लिए generated BuildConfig class में एक नया field कैसे बना सकते हैं?buildTypes {
debug {
buildConfig 'boolean', 'ENABLE_ANALYTICS', 'false'
}
release {
buildConfig 'boolean', 'ENABLE_ANALYTICS', 'true'
}
}
buildTypes {
debug {
buildConfig 'String', 'ENABLE_ANALYTICS', 'false'
}
release {
buildConfig 'String', 'ENABLE_ANALYTICS', 'true'
}
}
buildTypes {
debug {
buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'false'
}
release {
buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'true'
}
}
buildTypes {
debug {
buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'true'
}
release {
buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'false'
}
}
ProGuard -keepclassmembers जोड़े गए हैं@SerizlizedName लागू है
<androidx.constraintlayout.widget.ConstraintLayout
...>
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:padding="8dp"
android:textAlignment="center"
android:text="Dashboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
...>
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:text="Dashboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
...>
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:padding="8dp"
android:textAlignment="center"
android:text="Dashboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
...>
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:padding="8dp"
android:text="Dashboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
intent के माध्यम से आपकी Activity class तक पहुंचने से रोकेगी? <activity android:name=".ExampleActivity" />
<activity android:name=".ExampleActivity">
<intent-filter>
<action android:name="android.intent.action.SEND" />
</intent-filter>
</activity>
<activity android:name=".ExampleActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ExampleActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
व्याख्या: Intent filters का उपयोग intents का उपयोग करके activities को अन्य apps के लिए accessible बनाने के लिए किया जाता है। इसलिए हमें उस option को चुनना होगा जिसमें कोई intent filter नहीं है ताकि यह सुनिश्चित हो सके कि यह intent द्वारा accessible नहीं है
ActivityManager.isLowRamDevice() method का उपयोग करें कि क्या कोई device खुद को “low RAM” के रूप में define करता हैActivity.islowRam() method का उपयोग करें कि क्या कोई device खुद को “low RAM” के रूप में define करता हैConnectivityManager.hasLowMemory() method का उपयोग करें कि क्या कोई device खुद को “low RAM” के रूप में define करता है<include/> का उपयोग करें
<shape xmlns:android-"http://schemas.android.com/apk/res/android"
android:shape-"oval">
<gradient
android:startColor-"@android:color/white"
android:endColor-"@android:color/black"
android:angle-"45"/>
</shape>
<rectangle xmlns:android-"http://schemas.android.com/apk/res/android">
<gradient
android:startColor-"@android:color/white"
android:endColor-"android:color/black"
android:angle-"135"/>
</rectangle>
<shape xmlns:android-"http://schemas.android.com/apk/res/android"
android:shape-"rectangle">
<gradient
android:startColor-"@android:color/white"
android:endColor-"@android:color/black"
android:angle-"135"/>
</shape>
<shape xmlns:android-"http://schemas.android.com/apk/res/android"
android:shape-"rectangle">
<gradient
android:startColor-"@android:color/white"
android:endColor-"@android:color/black"
android:angle-"98"/>
</shape>

android {
...
defaultConfig{...}
buildTypes{
debug{...}
releasae{...}
}
flavorDimensions "environment"
productFlavors {
producation {...}
staging {...}
}
}
Conversion to Dalvik format filed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
<?xml version=1.0 encoding="utf-8"?>
<resources>
<dimen name="spacing_medium">8dp</dimen>
<dimen name="spacing_large">12dp</dimen>
</resources>
<ImageView
android:id=@+id/image_map_pin"
android:layout_width="wrap_content"
android:layout_heignt="wrap_content"
android:src=@drawable/map_pin />
<ImageView
android:id=@+id/image_map_pin"
android:layout_width="wrap_content"
android:layout_heignt="wrap_content"
androi:layout_botttom="@dimen/spacing_medium"
android:src=@drawable/map_pin />
<ImageView
android:id=@+id/image_map_pin"
android:layout_width="wrap_content"
android:layout_heignt="wrap_content"
android:layout_marginBottom="@resources/spacing_medium"
android:src=@drawable/map_pin />
<ImageView
android:id=@+id/image_map_pin"
android:layout_width="wrap_content"
android:layout_heignt="wrap_content"
android:layout_marginBottom="@dimen/spacing_medium"
android:src=@drawable/map_pin />
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_post_create)
if (savedInstanceState != null) return
val fragment = CreatePostFragment()
supportFragmentManager
.beginTransaction()
.add(R.id. fragment_container, fragment)
.commit()
}
Intent(this, AboutActivity::class).also { intent -> startService(intent)}Intent(this, AboutActivity::class.java).also { intent -> startActivity(intent)}Intent(this, AboutActivity::class).also { intent -> activity(intent)}Intent(this, AboutActivity::class).also { intent -> startActivity(intent)}व्याख्या: Intent(Context packageContext, Class<?> cls) ध्यान दें: Class न कि KClass
व्याख्या: जब आप Android Gradle plugin 3.4.0 या higher का उपयोग करके अपना project build करते हैं, तो plugin अब compile-time code optimization perform करने के लिए ProGuard का उपयोग नहीं करता है। इसके बजाय, plugin R8 compiler के साथ काम करता है
A

B

C

D

BuildConfigBuildInfoConfigParamsConfigInfo <androidx.constraintlayout.widget.ConstrantLayout
...>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstrantLayout>
Button की कोई size नहीं हैButton parent container के end से constrained नहीं हैButtons अपने default size से आगे expand नहीं हो सकतेButton की height भी 0dp set होनी चाहिएsystem services को manage करनाuser input events को process करनाinternet या local data source से data load करनाbitmap transformations perform करनाStringTextString-arrayPluralsonPause()onResume()onOpen()onStart() fun showCamera(view: View) {
Log.i(TAG, "Show camera button pressed.")
if (ContextCompat.shouldShowRequestPermissionRationale(thisActivity,
Manifest.permission.CAMERA) {
showCameraPreview()
}
else {
requestPermissionLauncher.launch(Manifest.permission.CAMERA)
}
}
fun showCamera(view: View) {
Log.i(TAG, "Show camera button pressed.")
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED) {
showCameraPreview()
}
else {
requestPermissionLauncher.launch(Manifest.permission.CAMERA)
}
}
fun showCamera(view: View) {
Log.i(TAG, "Show camera button pressed.")
showCameraPreview()
}
fun showCamera(view: View) {
Log.i(TAG, "Show camera button pressed.")
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
showCameraPreview()
}
else {
requestPermissionLauncher.launch(Manifest.permission.CAMERA)
}
}
<string name="upload_photo_notification">%1$d of %2$d photos uploaded</string>
val string: String = getString(
R.string.upload_photo_notification,
"2",
"5"
)
val string: String = getString(
R.id.upload_photo_notification,
2,
5
)
val string: String = getString(
R.string.upload_photo_notification,
2,
5
)
val string: String = getString(
R.id.upload_photo_notification,
"2",
"5"
)
"You have 1 day remaining"
"You have 2 days remaining"
<string name="trial_days_left_one"> You have %1$d day remaining</string>
<string name="trial_days_left_other">You have %1$d days remaining</string>
<plurals name="trial days left">
<plural quantity="one">You have %1$d day remaining</plural>
<plural quantity="other">You have %1$d days remaining</plural>
</plurals>
<plurals name="trial_days_left">
<item quantity="one">You have %1$d day remaining</item>
<item quantity="other">You have %1$d days remaining</item>
</plurals>
<string name="trial_days_left">
<plural quantity="one">You have %1$d day remaining</plural>
<plural quantity="other">You have &1$d days remaining</plural>
</string>
जब app uninstall होजब app backgrounded होजब device battery optimization mode में होजब main thread पर network requests बनाए जाएं
recyclerView.setLayoutManager(GridLayoutManager(this, 3))
val coulumnCount = resources.getInteger(R.integer.column_count)
recyclerView.setLayoutManager(GridLayoutManager(this, columnCount))
recyclerView.setLayoutManager(LinearLayoutManager(this))
val coulumnCount = resources.getInteger(R.integer.column_count)
recyclerView.setLayoutManager(LinearLayoutManager(this, columnCount))
intent बनाने का कौन सा लाभ नहीं है?intent को handle करने वाला app आपके design choices का सम्मान करेगाintent को handle करने वाला app UI provide करेगा