How to set AlertDialog button font color in Kotlin

526
January 29, 2018, at 3:03 PM

I know to setup font color in Java of AlertDialog button we can do like

dialog.setOnShowListener( new OnShowListener() {
    @Override
    public void onShow(DialogInterface arg0) {
        dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(COLOR_I_WANT);
    }
});

It unclear how to do it in Kotlin's style?

val alert = AlertDialog.Builder(activity)
var editTextAge: EditText? = null
with(alert) {
    setTitle("Settings")
    setMessage("Some text")
    setPositiveButton("OK") { dialog, whichButton ->
    dialog.dismiss()
    dialogMain.apply {
       activity.setupDialogStuff(view, this) {
                             //....
      }
   }
   setNegativeButton("NO") { dialog, whichButton ->
       dialog.dismiss()
                // set color of this button???
            }
        }
val dialog = alert.create()
dialog.setView(editTextAge)
dialog.show()
Rent Charter Buses Company
READ ALSO
Could java library 'colt' replace with python library 'numpy'? How is the performance of colt?

Could java library 'colt' replace with python library 'numpy'? How is the performance of colt?

I don't really like implement models using python, but numpy is really goodThus currently I'm seeking an equivalent of numpy in java and somebody recommended 'colt'

209
listview not displaying text custom adapter

listview not displaying text custom adapter

I am trying to use a custom adapter to display some text to a listview and when i run the app on my phone it crashes

183
How to add a node at specified index in LinkedList implementation

How to add a node at specified index in LinkedList implementation

So I am implementing a LinkedList from scratch and one method, insertAt(int index, T elem), is really giving me a headacheThe method is supposed to insert a node at the specified index and move the rest of the list accordingly

218
Extract string content from rtf string java

Extract string content from rtf string java

I've following rtf string: \af31507 \ltrch\fcs0 \insrsid6361256 Study Title: {Test for 14431 process\'27s \u8805 1000 Testing2 14432 \u8805 8000}}{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid12283827 and I want to extract the content of Study Title ie (Study...

257