public class

Dialog

extends Object
java.lang.Object
   ↳ com.neomades.ui.dialog.Dialog
Known Direct Subclasses

Class Overview

Simple Dialog popup with custom content.

Title is optional (set title to null in order to hide the title)

Content could be any type of view.

By default, a dialog is cancellable in all platforms except iOS.

Cross Platform Considerations

  • iOS: a dialog is never cancellable with BACK button because the device has not a physical BACK button. setCancellable(true) in iOS will be ignored!

Summary

Public Constructors
Dialog()
Public Methods
void hide()
Hides this dialog (if shown).
boolean isShown()
void setCancellable(boolean cancellable)
Sets if the dialog is cancellable with the BACK button.
void setContent(View content)
Set content of the dialog.
void setTitle(String title)
Sets the title of this dialog
void setTitle(int resId)
Sets the title of this dialog
void show()
Shows this dialog in top of the current screen.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Dialog ()

Public Methods

public void hide ()

Hides this dialog (if shown).

Warning : this method has to be called from the UI-Thread. Use runOnUiThread(Runnable) if you are on another thread

Throws
CrossThreadException if the method is called from outside the UI-Thread
See Also

public boolean isShown ()

Returns
  • if this dialog is showing.

public void setCancellable (boolean cancellable)

Sets if the dialog is cancellable with the BACK button. If the parameter is true, the dialog can be cancelled with the BACK key, and then will be closed, else the BACK key won't do nothing.

By default, a dialog is cancellable in all platforms except iOS.

Cross Platform considerations

  • iOS: a dialog is never cancellable with BACK button because the device does not have a physical BACK button. setCancellable(true) in iOS will be ignored!

Parameters
cancellable true if the dialog can be cancelled, else false

public void setContent (View content)

Set content of the dialog.

Parameters
content any type of View

public void setTitle (String title)

Sets the title of this dialog

Parameters
title the title

public void setTitle (int resId)

Sets the title of this dialog

Parameters
resId the id of the title

public void show ()

Shows this dialog in top of the current screen.

Note: Only one dialog can be shown in top of screen.

Warning : this method has to be called from the UI-Thread. Use runOnUiThread(Runnable) if you are on another thread

When a dialog is shown, the screen behind it will keep its state (not paused, not resumed).

Throws
CrossThreadException if the method is called from outside the UI-Thread