package com.quickblox.sample.core.ui.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;

import java.lang.reflect.Field;

public class CoreBaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // Hack. Forcing overflow button on actionbar on devices with hardware menu button
        try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
            if (menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception ex) {
            // Ignore
        }
    }

    @SuppressWarnings("unchecked")
    public <T extends View> T _findViewById(int viewId) {
        return (T) findViewById(viewId);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

}

@@ -67,16 +67,57 @@
 Bundle;%0A
+import android.support.v7.app.ActionBar;%0A
 import a
@@ -157,16 +157,16 @@
 tivity;%0A
-
 import a
@@ -343,16 +343,51 @@
 tivity %7B
+%0A    protected ActionBar actionBar;
 %0A%0A    @O
@@ -495,24 +495,25 @@
 State);%0A
+%0A
         
 %0A       
@@ -504,16 +504,51 @@
         
+actionBar = getSupportActionBar();%0A
 %0A       
@@ -1181,24 +1181,160 @@
 Id);%0A    %7D%0A%0A
+    public void setActionBarTitle(int title) %7B%0A        if (actionBar != null) %7B%0A            actionBar.setTitle(title);%0A        %7D%0A    %7D%0A%0A
     @Overrid

Add actionbar to CoreBaseActivity