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)
}
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
}
Aviso: AndroidJUnitRunner nos permite ejecutar pruebas de estilo JUnit3/4 en dispositivos Android
Explicación: En el método “getDefaultSharedPrefarances(this).getString()” se pasa el segundo parámetro para que se pueda devolver, en caso de que la clave no exista. Por lo tanto, debemos pasar una cadena vacía para devolverla en caso de que la clave no exista.

<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? <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)
startActivityWithResult() debe usarse en lugar de startActivity() cuando se utiliza Intent.ACTION_DIAL.Intent.ACTION_DIALel Intent opción Intent.FLAG_ACTIVITY_NEW_TASK Debe agregarse al utilizar esto dialerIntent.dialerIntent provocará que se lance una excepción ActivityNotFoundException en dispositivos que no admiten Intent.ACTION_DIAL.android.permission.CALL_PHONE debe solicitarse primero antes Intent.ACTION_DIAL se puede utilizar./assets ¿directorio?resource IDgustar R.assets.filenameResources.openRawResource()intent, en lugar de solicitar el permiso de la cámara directamente?intent respetará sus elecciones de diseño.intent proporcionará la interfaz de usuario.ActivityCompat.shouldShowRequestPermissionRationale() ¿función?release Construye. ¿Cómo se puede crear un nuevo campo en el generado? BuildConfig para almacenar ese valor? 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 se han añadido a los objetos de transferencia de datos de red (DTO) en cuestión@SerizlizedName aplicado a sus propiedades miembro
<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>
_not_ disponible para usted de forma predeterminada cuando Android Studio crea un nuevo proyecto?Activity clase a través de un intent? <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>
Explicación: Los filtros de intención se usan para hacer que las actividades sean accesibles para otras aplicaciones mediante intenciones. Por lo tanto, tenemos que elegir opciones que no tengan filtro de intención para asegurarnos de que no sea accesible por intención.
ActivityManager.isLowRamDevice() método para averiguar si un dispositivo se define a sí mismo como “baja RAM”.Activity.islowRam() método para averiguar si un dispositivo se define a sí mismo como “baja RAM”.ConnectivityManager.hasLowMemory() método para averiguar si un dispositivo se define a sí mismo como “baja RAM”._not_ una buena manera de reutilizar el código de Android?<include/> para incluirlos en otros archivos XML de diseño.
<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(intención) }
Intent(this, AboutActivity::class.java).also { intent -> startActivity(intención) }
Intent(this, AboutActivity::class).also { intent -> actividad(intención) }
Intent(this, AboutActivity::class).also { intent -> startActivity(intención) } Explicación: Intención(Context packageContext, Class<?> cls) Aviso: Clase no KClass
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>
The button does not have a sizeThe button is not constrained to the end of the parent containerButtons cannot expand beyond their default sizeThe button should have its height set to 0dp as wellmanaging system servicesprocessing user input eventsloading data from the internet or a local data sourceperfoming bitmap transformatinosStringTextString-arrayPlurals