public class

MessageFragment

extends Fragment
java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ com.urbanairship.messagecenter.MessageFragment

Class Overview

Fragment that displays a Message.

Summary

Constants
int ERROR_DISPLAYING_MESSAGE Error displaying the message.
int ERROR_FETCHING_MESSAGES Unable to fetch messages.
int ERROR_MESSAGE_UNAVAILABLE Message has been deleted or expired.
String MESSAGE_ID Argument key to specify the message Reporting
[Expand]
Inherited Fields
From class androidx.fragment.app.Fragment
Public Constructors
MessageFragment()
Public Methods
String getMessageId()
Returns the fragment's Message ID.
static MessageFragment newInstance(String messageId)
Creates a new MessageFragment
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Subclasses can override to replace with their own layout.
void onDestroyView()
void onPause()
void onResume()
void onStart()
void onStop()
void onViewCreated(View view, Bundle savedInstanceState)
Protected Methods
void retry()
Retries loading the message.
void showErrorPage(int error)
Shows the error page.
void showMessage()
Shows the message.
void showProgress()
Shows the progress bar
[Expand]
Inherited Methods
From class androidx.fragment.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener
From interface androidx.activity.result.ActivityResultCaller
From interface androidx.lifecycle.HasDefaultViewModelProviderFactory
From interface androidx.lifecycle.LifecycleOwner
From interface androidx.lifecycle.ViewModelStoreOwner
From interface androidx.savedstate.SavedStateRegistryOwner

Constants

protected static final int ERROR_DISPLAYING_MESSAGE

Error displaying the message.

Constant Value: 2 (0x00000002)

protected static final int ERROR_FETCHING_MESSAGES

Unable to fetch messages.

Constant Value: 1 (0x00000001)

protected static final int ERROR_MESSAGE_UNAVAILABLE

Message has been deleted or expired.

Constant Value: 3 (0x00000003)

public static final String MESSAGE_ID

Argument key to specify the message Reporting

Constant Value: "messageReporting"

Public Constructors

public MessageFragment ()

Public Methods

public String getMessageId ()

Returns the fragment's Message ID.

Returns

public static MessageFragment newInstance (String messageId)

Creates a new MessageFragment

Parameters
messageId The message's ID to display
Returns
  • messageFragment new MessageFragment

public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Subclasses can override to replace with their own layout. If doing so, the returned view hierarchy must have a MessageWebView whose id is android.R.id.message, a progress view whose id is android.R.id.progress, and can optionally error page with a view id R.id.error.

Parameters
inflater The LayoutInflater object that can be used to inflate any views in the fragment,
container If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.
savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
  • Return the View for the fragment's UI, or null.

public void onDestroyView ()

public void onPause ()

public void onResume ()

public void onStart ()

public void onStop ()

public void onViewCreated (View view, Bundle savedInstanceState)

Protected Methods

protected void retry ()

Retries loading the message.

protected void showErrorPage (int error)

Shows the error page.

Parameters
error The error.

protected void showMessage ()

Shows the message.

protected void showProgress ()

Shows the progress bar