大约有 366 项符合查询结果(耗时:0.0346秒) [XML]
How to check if my string is equal to null?
... return true;
}
else {
return false;
}
Updated
For Kotlin we check if the string is null or not by following
return myString.isNullOrEmpty() // Returns `true` if this nullable String is either `null` or empty, false otherwise
return myString.isEmpty() // Returns `true` if th...
Programmatically go back to the previous fragment in the backstack
...
requireActivity().onBackPressed() for Kotlin
– Ayxan Haqverdili
Jul 10 at 10:35
add a comment
|
...
How to build sources jar with gradle
...
The Kotlin DSL equivalent would be:
tasks {
val sourcesJar by creating(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
classifier = "sources"
from(java.sourceSets["main"].allSource)
}
...
Calling a Fragment method from a parent Activity
...gment.<specific_function_name>();
Update:
For those who are using Kotlin
var fragment = supportFragmentManager.findFragmentById(R.id.frameLayoutCW) as WebViewFragment
fragment.callAboutUsActivity()
share
...
How do I change the android actionbar title and icon
... @JoseManuelAbarcaRodríguez Thank you, that's what was missing for me. In Kotlin: supportActionBar?.setDisplayShowTitleEnabled(true) then supportActionBar?.title = "your title". And it has to be done in onResume, not in onCreate, when creating the activity with startActivity.
–...
How do I get the dialer to open with phone number displayed?
...swer to this question. But here is just one sample if you want to do it in Kotlin.
val intent = Intent(Intent.ACTION_DIAL)
intent.data = Uri.parse("tel:<number>")
startActivity(intent)
Thought it might help someone.
...
Remove a marker from a GoogleMap
...
If you use Kotlin language you just add this code:
Create global variables of GoogleMap and Marker types.
I use variable marker to make variable marker value can change directly
private lateinit var map: GoogleMap
private lateinit va...
How to programmatically set drawableLeft on Android button?
...
• Kotlin Version
Use below snippet to add a drawable left to the button:
val drawable = ContextCompat.getDrawable(context, R.drawable.ic_favorite_white_16dp)
button.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null...
What is the default text size on Android?
...
This will return default size of text on button in pixels.
Kotlin
val size = Button(this).textSize
Java
float size = new Button(this).getTextSize();
share
|
improve this answe...
Set color of TextView span in Android
...
Kotlin + Spannable String solution would look like this stackoverflow.com/questions/4032676/…
– Dmitrii Leonov
Jan 1 at 4:29
...