Initializing Logging and the MAF Core

To initialize logging and the MAFCore, insert these lines into your activity’s onCreate method:

MAFLogger.logToAndroid(true);
MAFLogger.setLogLevel(IMAFLogger.INFO);
// Sets the default (built-in) layout and styling configuration.
MAFCoreBuilder.setDefaultConfiguration(this, R.raw.layout_phone, R.raw.styles_def);
MAFCoreBuilder mafCoreBuilder = new MAFCoreBuilder(this, false);
mafCore = mafCoreBuilder.build();
mafCore.switchScreen(this);

When you save the activity’s class file, You get this error: „MAFCore cannot be resolved to a variable”. To resolve this, define and add mafCore as a class member field with the type of MAFCore to the activity. The R.was.styles_def value refers to the class that is generated from an XML file located in the resource library in the mafuicomponents. This XML specifies default styling for the UI elements.

Comment or remove the setContentView method invocation from the onCreate method, as the screen is now constructed by MAF Extensibility and initialized by the mafCore.switchScreen method invocation.

Android extensibility implements its own Activity class. Insert this class in the project’s AndroidManifest.xml. Insert this line between the application tags:
<activity android:name="com.sap.maf.ext.MAFTileActivity"/>
You can now run the application, which shows a blank white screen.