Get Started with login screenlet in Liferay DXP


April 27, 2022

Liferay provides the screenlets, which are the readymade screen for the faster android app development for Liferay apps. Liferay Screens for Android contains several Screenlets that you can use in your Android apps.

Liferay offers bunch of screenlets which is called Screenlet Library. You can know more about it from following link,


In this post, we will discuss about login screenlet. Following are some prerequisite to implement screenlets,


  1. Liferay 7 must be installed. (
  2. Android Studio .(

Configure Login screenlet:

Before we discuss steps to implement screenlets, it is important for you to understand that Android project configuration. You can learn about Android project in Liferay from following link,

Now, lets understand the steps to generate screenlet as follow,

  1. Create new project in android studio

    1. To create an android project in Android studio, follow the following steps and click next,

File->New Project ->Fill up the detail as follow,

Application Name: Provide appropriate name e.g.” LoginScreenletDemo”

Company Domain: provide appropriate name e.g.”com.enprowess.loginscreenletdemo”

  1. Select form factor and click next,

For this example, I selected phone and template and maximum SDK as API 15 Android 4.0.3

  1. Select Empty Activity from this screen and click next ,
  2. Provide activity name and click on finish. In this example, I provided activity name as ” LoginActivity,
  3. On click of finish, you will see following folder structure created,

Configure Login screenlet

  1. Add Liferay libraries for screenlets

Liferay provides bunch of screenlets. In order to get access to those screenlet, you need to add dependency in file as follow. After adding dependency sync the project to get access of Liferay screenlets.

android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'


. . . .

. . . .

compile ''
compile ''
compile ''
compile ''
compile ''
compile 'net.the4thdimension:android-utils:2.0.4'

  1. Configure login Screenlet for logging into Liferay instance

Configure UI for logging activity by adding the following code in your activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
xmlns:liferay = ""

liferay:layoutId="@layout/login_default" />

  1. Configure Liferay server

You can configure Liferay server details in server_context.xml under your res/values folder. Please see following code snipped for the reference.

Following is the quick summery for the attributes to configure,

liferay_server : Server address of your Liferay instance is running.

liferay_company_id : Company id for the instance

liferay_portal_version : Liferay version server is running Liferay 7 (70)

  1. Update

Screenlet provides the interfaces to get a result of web service calls by mobile SDK. For login, you need to implement LoginListener which provides following two methods that you need to implement,

i) onLoginSuccess()


ii) onLoginFailure()


  1. Run Application

Select your application -> click on run icon -> Create new Virtual Device -> Select Phone and then model of your choice then click next -> Select System image (for testing I used Nouget) -> Finally select orientation (I selected Portrait view) and click on finish

You will see your first Liferay login screenlet as follow,

Liferay login screenlet

Post by,
Sejal Patel