How to open our project/module activity from Applozic module?

Snehil Chouhan Source

I am using Applozic to integrate Chat in my app.

I have done all process and chat is working fine,

As I am doing customizations, I need to get back to my app's activity from applozic module class/activity.

When I write intent code, it shows my app should added as module inside applozic, but I have already added applozic to my app. It will become circular if I add again, although I have tried adding but still it is not working,

Please let me know, How to open our project/module activity from Applozic module?




answered 6 months ago Ashish Kanswal #1

You can open your Activity from applozic's ui module using the following ways:

1) Launch the activity directly using its name:

        String activityName = "YourActivityName";
        Class activityToOpen = Class.forName(activityName);
        Intent intent = new Intent(this, activityToOpen);
      }catch(ClassNotFoundException e){

2) Create an interface in mobicomkitui's uilistener package with a call method:

package com.applozic.mobicomkit.uiwidgets.uilistener;

import android.content.Context;

public interface AlActionCallback {
    void onAction(Context context, String action, Object object); 

Call the interface method on press of a button or something, from where you want to launch the activity

  ((AlActionCallback) getActivity().getApplication()).onAction(getContext(), "startMyActivity", SomeObject);

Implement this interface in your Application class:

public class MyApplication extends MultiDexApplication implements AlActionCallback {

    public void onCreate() {

    public void onAction(Context context, String action, Object object) {
        if(action != null){
            switch (action){
                case "startMyActivity" :
                     SomeObject obj = (SomeObject) object;
                     Intent intent = new Intent(context, YourActivity.class);

comments powered by Disqus