大约有 366 项符合查询结果(耗时:0.0289秒) [XML]

https://stackoverflow.com/ques... 

Reasons that the passed Intent would be NULL in onStartCommand

... in kotlin, the intent is marked as not-null, and it crashes the app override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {} – Muhammad Naderi Apr 10 '18 at 5:08 ...
https://stackoverflow.com/ques... 

How do I add a new sourceset to Gradle?

...uring integration tests Example 14 and 15 for details (both for Groovy and Kotlin DSL, either which one you prefer) alt: "current" Gradle doc link at 2, but might defer in future, you should have a look at if examples changes) for Gradle 4 have a look at ancient version 3 which is close near to w...
https://stackoverflow.com/ques... 

How to Copy Text to Clip Board in Android?

... As a handy kotlin extension: fun Context.copyToClipboard(text: CharSequence){ val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager val clip = ClipData.newPlainText("label",text) clipboard.primary...
https://stackoverflow.com/ques... 

How to get the absolute coordinates of a view

... First Way: In Kotlin we can create a simple extension for view: fun View.getLocationOnScreen(): Point { val location = IntArray(2) this.getLocationOnScreen(location) return Poi
https://stackoverflow.com/ques... 

Is it possible dynamically to add String to String.xml in Android?

... In Kotlin you just need to set your string value like this: <string name="song_number_and_title">"%1$d ~ %2$s"</string> Create a text view on your layout: <TextView android:id="@+id/song_number_and_title"/>...
https://stackoverflow.com/ques... 

Can't create handler inside thread that has not called Looper.prepare()

...st = Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT); } }); KOTLIN Handler(Looper.getMainLooper()).post { Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT) } An advantage of this method is that you can use it without Activity or Context. ...
https://stackoverflow.com/ques... 

How to pass an object from one activity to another on Android

...on.fromJson(getIntent().getStringExtra("myjson"), YourObject.class); For Kotlin it's quite the same Pass the data val gson = Gson() val intent = Intent(this, YourActivity::class.java) intent.putExtra("identifier", gson.toJson(your_object)) startActivity(intent) Receive the data val gson = Gso...
https://stackoverflow.com/ques... 

How to find/remove unused dependencies in Gradle

... This plugin sadly doesn't work with the kotlin dsl. They have no plans to support it. – snowe Feb 1 '19 at 18:09 3 ...
https://stackoverflow.com/ques... 

Saving and Reading Bitmaps/Images from Internal memory in Android

... For Kotlin users, I created a ImageStorageManager class which will handle save, get and delete actions for images easily: class ImageStorageManager { companion object { fun saveToInternalStorage(context: Context, bit...
https://stackoverflow.com/ques... 

How do I open the SearchView programmatically?

...s from other fragment. if (myViewModel.filterTextSaved.isNotEmpty()) { // Kotlin, storing state in ViewModel searchItem.expandActionView() // needs to come first, otherwise empty text theTextArea.setText(courseViewModel.filterTextOnClick) } and for the menu I keep always|collapseActionVie...