The MAFLogViewer component provides a standard UI to show log entries in an application. MAFLogViewer uses SDMLogger or MAFLogger as a source, and shows the entries from these loggers. It can also send the log entries to a predefined recipient. MAFLogViewer is built from skinnable components.
MAFLogViewer is a complex reusable control, which means that it is built on top of simple controls, such as MAFActionBar and MAFListView. MAFLogViewer depends on the MAFUIControls library and the MAFLogger.
MAFLogViewer logViewer = new MAFLogViewer( this, logger ); setContentView(logViewer);
<com.sap.maf.uicontrols.logviewer.MAFLogViewer xmlns:x="http://schemas.sap.com/maf/2011/ux" android:id="@+id/logviewer" android:layout_width="match_parent" android:layout_height="match_parent" x:email = "sap@sap.com" x:subject = "Test LogViewer" x:title = "Log Test title">
setContentView(R.layout.logviewer); MAFLogViewer logViewer = (MAFLogViewer) findViewById(R.id.logviewer); logViewer.setLogger(logger)
If there is a source set, but you call the setLogger() API with a new SDMLogger instance, the new instance is used, and the old entries are dropped.
If you present the MAFLogViewer without an SDMLogger instance, it creates an instance and enters one log entry with error severity: No logger was set.
The default subject is Log Entries, which is localized for supported languages.
The default title for the log viewer is Log Viewer, which is localized for supported languages.
MAFLogViewer supports sending log entries to a predefined e-mail address. If there is no e-mail set, the user must use an e-mail application.
To send the logs, tap the action button on the right side of the action bar. This triggers a sending intent, where the content’s MIME type is message/rfc822. A list of apps that can handle these messages, such as Gmail or Exchange, is presented.
After an app is selected, MAFLogViewer passes the predefined e-mail address, subject, and content to the application, which, if configured properly, opens a new e-mail message that contains the sent content.