1

I'm trying to upgrade an old app that used ActionBarSherlock before. I think I've replaced all things using it with the newer ones. Currently I'm getting the error on the title which is weird and surely difficult to fix. I've already looked up for the fix to it and applied every one of it but I still get the error. I tried to use AppCompatImageButton but when I do that the error now says Error inflating class android.widget.AppCompatImageButton. The error log is below.

FATAL EXCEPTION: main
    Process: com.csipsimple, PID: 22863
    android.view.InflateException: Binary XML file line #113: Binary XML file line #4: Error inflating class com.csipsimple.widgets.Dialpad
    Caused by: android.view.InflateException: Binary XML file line #4: Error inflating class com.csipsimple.widgets.Dialpad
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at android.view.LayoutInflater.createView(Unknown Source:194)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:197)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:6)
        at android.view.LayoutInflater.rInflate(Unknown Source:101)
        at android.view.LayoutInflater.parseInclude(Unknown Source:284)
        at android.view.LayoutInflater.rInflate(Unknown Source:79)
        at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
        at android.view.LayoutInflater.inflate(Unknown Source:264)
        at android.view.LayoutInflater.inflate(Unknown Source:20)
        at com.csipsimple.ui.dialpad.DialerFragment.onCreateView(DialerFragment.java:211)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
        at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
        at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
        at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:146)
        at android.support.v4.view.ViewPager.populate(ViewPager.java:1244)
        at android.support.v4.view.ViewPager.populate(ViewPager.java:1092)
        at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1622)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at android.widget.FrameLayout.onMeasure(Unknown Source:65)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(Unknown Source:340)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at android.widget.FrameLayout.onMeasure(Unknown Source:65)
        at com.android.internal.policy.DecorView.onMeasure(Unknown Source:344)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewRootImpl.performMeasure(Unknown Source:15)
        at android.view.ViewRootImpl.measureHierarchy(Unknown Source:78)
        at android.view.ViewRootImpl.performTraversals(Unknown Source:446)
        at android.view.ViewRootImpl.doTraversal(Unknown Source:32)
        at android.view.ViewRootImpl$TraversalRunnable.run(Unknown Source:2)
        at android.view.Choreographer$CallbackRecord.run(Unknown Source:20)
        at android.view.Choreographer.doCallbacks(Unknown Source:106)
        at android.view.Choreographer.doFrame(Unknown Source:212)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Unknown Source:9)
        at android.os.Handler.handleCallback(Unknown Source:2)
        at android.os.Handler.dispatchMessage(Unknown Source:4)
        at android.os.Looper.loop(Unknown Source:152)
        at android.app.ActivityThread.main(Unknown Source:65)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
2019-07-22 23:57:16.019 22863-22863/com.csipsimple E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(Unknown Source:338)
     Caused by: android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class android.widget.ImageButton
     Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class android.widget.ImageButton
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at android.view.LayoutInflater.createView(Unknown Source:194)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(Unknown Source:8)
        at android.view.LayoutInflater.onCreateView(Unknown Source:0)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:155)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:6)
        at android.view.LayoutInflater.rInflate(Unknown Source:101)
        at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
        at android.view.LayoutInflater.rInflate(Unknown Source:112)
        at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
        at android.view.LayoutInflater.inflate(Unknown Source:264)
        at android.view.LayoutInflater.inflate(Unknown Source:20)
        at com.csipsimple.widgets.Dialpad.initLayout(Dialpad.java:112)
        at com.csipsimple.widgets.Dialpad.<init>(Dialpad.java:107)
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at android.view.LayoutInflater.createView(Unknown Source:194)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:197)
        at android.view.LayoutInflater.createViewFromTag(Unknown Source:6)
        at android.view.LayoutInflater.rInflate(Unknown Source:101)
        at android.view.LayoutInflater.parseInclude(Unknown Source:284)
        at android.view.LayoutInflater.rInflate(Unknown Source:79)
        at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
        at android.view.LayoutInflater.inflate(Unknown Source:264)
        at android.view.LayoutInflater.inflate(Unknown Source:20)
        at com.csipsimple.ui.dialpad.DialerFragment.onCreateView(DialerFragment.java:211)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
        at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
        at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
        at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:146)
        at android.support.v4.view.ViewPager.populate(ViewPager.java:1244)
        at android.support.v4.view.ViewPager.populate(ViewPager.java:1092)
        at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1622)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at android.widget.FrameLayout.onMeasure(Unknown Source:65)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(Unknown Source:340)
        at android.view.View.measure(Unknown Source:250)
        at android.view.ViewGroup.measureChildWithMargins(Unknown Source:42)
        at android.widget.FrameLayout.onMeasure(Unknown Source:65)
        at com.android.internal.policy.DecorView.onMeasure(Unknown Source:344)
2019-07-22 23:57:16.021 22863-22863/com.csipsimple E/AndroidRuntime:     at android.view.View.measure(Unknown Source:250)
        at android.view.ViewRootImpl.performMeasure(Unknown Source:15)
        at android.view.ViewRootImpl.measureHierarchy(Unknown Source:78)
        at android.view.ViewRootImpl.performTraversals(Unknown Source:446)
        at android.view.ViewRootImpl.doTraversal(Unknown Source:32)
        at android.view.ViewRootImpl$TraversalRunnable.run(Unknown Source:2)
        at android.view.Choreographer$CallbackRecord.run(Unknown Source:20)
        at android.view.Choreographer.doCallbacks(Unknown Source:106)
        at android.view.Choreographer.doFrame(Unknown Source:212)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Unknown Source:9)
        at android.os.Handler.handleCallback(Unknown Source:2)
        at android.os.Handler.dispatchMessage(Unknown Source:4)
        at android.os.Looper.loop(Unknown Source:152)
        at android.app.ActivityThread.main(Unknown Source:65)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
        at com.android.internal.os.ZygoteInit.main(Unknown Source:338)
     Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f030002 a=6}
        at android.content.res.TypedArray.getDrawableForDensity(Unknown Source:61)
        at android.content.res.TypedArray.getDrawable(Unknown Source:1)
        at android.view.View.<init>(Unknown Source:132)
        at android.widget.ImageView.<init>(Unknown Source:7)
        at android.widget.ImageButton.<init>(Unknown Source:0)
        at android.widget.ImageButton.<init>(Unknown Source:1)
        at android.widget.ImageButton.<init>(Unknown Source:3)
            ... 68 more

DialogFragment.java:211 is

final View v = inflater.inflate(R.layout.dialer_digit, container, false);

dialer_digit.xml is

<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2010 Regis Montoya (aka r3gis - www.r3gis.fr) 
    Copyright (C) 2008 The Android Open Source Project

    This file is part of CSipSimple.
    CSipSimple is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    If you own a pjsip commercial license you can also redistribute it
    and/or modify it under the terms of the GNU Lesser General Public License
    as an android library.

    CSipSimple is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with CSipSimple.  If not, see <http://www.gnu.org/licenses/>.
-->

<com.csipsimple.ui.dialpad.DialerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/top_digit_dialer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:baselineAligned="false"
    android:orientation="vertical">

    <RelativeLayout
        android:id="@+id/topField"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/dialpad_background"
        android:orientation="horizontal">

        <com.csipsimple.ui.dialpad.DigitsEditText
            android:id="@+id/digitsText"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_toStartOf="@+id/accountChooserButton"
            android:layout_toLeftOf="@+id/accountChooserButton"
            android:background="@android:color/transparent"
            android:contentDescription="@string/description_digits_edittext"
            android:gravity="center"
            android:imeActionLabel="@string/call"
            android:imeOptions="actionGo"
            android:nextFocusRight="@+id/accountChooserButton"
            android:textAppearance="@style/DialtactsDigitsTextAppearance"
            android:textColor="@android:color/white" />

        <TextView
            android:id="@+id/rewriteTextInfo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentBottom="true"
            android:layout_toLeftOf="@+id/accountChooserButton"
            android:layout_toStartOf="@+id/accountChooserButton"
            android:gravity="center"
            android:textColor="#88FFFFFF"
            android:textSize="12sp"
            android:textStyle="italic"
            android:visibility="gone" />

        <com.csipsimple.widgets.AccountChooserButton
            android:id="@+id/accountChooserButton"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true" />

        <RelativeLayout
            android:id="@+id/lytCallFrontDesk"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="#40aaaaaa"
            android:gravity="center_vertical">

            <ImageView
                android:id="@+id/imgDialerDigitCall"
                android:layout_width="60dp"
                android:layout_height="60dp"
                android:layout_margin="8dp"
                android:adjustViewBounds="true"
                android:contentDescription="telephone_logo"
                android:cropToPadding="false"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:scaleType="fitCenter"
                android:src="@drawable/csip_guest_services" />

        </RelativeLayout>

    </RelativeLayout>
    <!-- Autocomplete -->

    <ListView
        android:id="@+id/autoCompleteList"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="@integer/dialpad_layout_weight_autocomplete_list"
        android:visibility="gone" />

    <!-- Keypad section -->

    <include layout="@layout/dialpad_compose" />

</com.csipsimple.ui.dialpad.DialerLayout>

DialerLayout is a LinearLayout.

Dialpad is

/*
 * Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr)
 * This file is part of CSipSimple.
 *
 *  CSipSimple is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  If you own a pjsip commercial license you can also redistribute it
 *  and/or modify it under the terms of the GNU Lesser General Public License
 *  as an android library.
 *
 *  CSipSimple is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with CSipSimple.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.csipsimple.widgets;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.media.ToneGenerator;
import android.support.v7.widget.AppCompatImageButton;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;

import com.csipsimple.R;
import com.csipsimple.utils.Theme;

import java.util.HashMap;
import java.util.Map;

public class Dialpad extends FrameLayout implements View.OnClickListener {

    private OnDialKeyListener onDialKeyListener;

    // Here we need a map to quickly find if the clicked button id is in the map keys
    @SuppressLint("UseSparseArrays")
    private static final Map<Integer, int[]> DIGITS_BTNS = new HashMap<>();

    static {
        DIGITS_BTNS.put(R.id.button0, new int[] {ToneGenerator.TONE_DTMF_0, KeyEvent.KEYCODE_0});
        DIGITS_BTNS.put(R.id.button1, new int[] {ToneGenerator.TONE_DTMF_1, KeyEvent.KEYCODE_1});
        DIGITS_BTNS.put(R.id.button2, new int[] {ToneGenerator.TONE_DTMF_2, KeyEvent.KEYCODE_2});
        DIGITS_BTNS.put(R.id.button3, new int[] {ToneGenerator.TONE_DTMF_3, KeyEvent.KEYCODE_3});
        DIGITS_BTNS.put(R.id.button4, new int[] {ToneGenerator.TONE_DTMF_4, KeyEvent.KEYCODE_4});
        DIGITS_BTNS.put(R.id.button5, new int[] {ToneGenerator.TONE_DTMF_5, KeyEvent.KEYCODE_5});
        DIGITS_BTNS.put(R.id.button6, new int[] {ToneGenerator.TONE_DTMF_6, KeyEvent.KEYCODE_6});
        DIGITS_BTNS.put(R.id.button7, new int[] {ToneGenerator.TONE_DTMF_7, KeyEvent.KEYCODE_7});
        DIGITS_BTNS.put(R.id.button8, new int[] {ToneGenerator.TONE_DTMF_8, KeyEvent.KEYCODE_8});
        DIGITS_BTNS.put(R.id.button9, new int[] {ToneGenerator.TONE_DTMF_9, KeyEvent.KEYCODE_9});
        DIGITS_BTNS.put(R.id.buttonpound, new int[] {ToneGenerator.TONE_DTMF_P, KeyEvent.KEYCODE_POUND});
        DIGITS_BTNS.put(R.id.buttonstar, new int[] {ToneGenerator.TONE_DTMF_S, KeyEvent.KEYCODE_STAR});
    }

    private static final SparseArray<String> DIGITS_NAMES = new SparseArray<>();

    private static final String THIS_FILE = null;
    static {
        DIGITS_NAMES.put(R.id.button0, "0");
        DIGITS_NAMES.put(R.id.button1, "1");
        DIGITS_NAMES.put(R.id.button2, "2");
        DIGITS_NAMES.put(R.id.button3, "3");
        DIGITS_NAMES.put(R.id.button4, "4");
        DIGITS_NAMES.put(R.id.button5, "5");
        DIGITS_NAMES.put(R.id.button6, "6");
        DIGITS_NAMES.put(R.id.button7, "7");
        DIGITS_NAMES.put(R.id.button8, "8");
        DIGITS_NAMES.put(R.id.button9, "9");
        DIGITS_NAMES.put(R.id.buttonpound, "pound");
        DIGITS_NAMES.put(R.id.buttonstar, "star");
    }

    /**
     * Interface definition for a callback to be invoked when a tab is triggered
     * by moving it beyond a target zone.
     */
    public interface OnDialKeyListener {

        /**
         * Called when the user make an action
         * 
         * @param keyCode keyCode pressed
         * @param dialTone corresponding dialtone
         */
        void onTrigger(int keyCode, int dialTone);
    }

    public Dialpad(Context context) {
        super(context);
        initLayout(context);
    }

    public Dialpad(Context context, AttributeSet attrs) {
        super(context, attrs);
        initLayout(context);
    }

    private void initLayout(Context context) {
        LayoutInflater inflater = LayoutInflater.from(context);
        inflater.inflate(R.layout.dialpad, this, true);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        for(int buttonId : DIGITS_BTNS.keySet()) {
            ImageButton button = findViewById(buttonId);
            if(button != null) {
                button.setOnClickListener(this);
            }
        }

    }


    /**
     * Registers a callback to be invoked when the user triggers an event.
     * 
     * @param listener
     *            the OnTriggerListener to attach to this view
     */
    public void setOnDialKeyListener(OnDialKeyListener listener) {
        onDialKeyListener = listener;
    }

    private void dispatchDialKeyEvent(int buttonId) {
        if (onDialKeyListener != null && DIGITS_BTNS.containsKey(buttonId)) {
            int[] datas = DIGITS_BTNS.get(buttonId);
            onDialKeyListener.onTrigger(datas[1], datas[0]);
        }
    }

    @Override
    public void onClick(View v) {
        dispatchDialKeyEvent(v.getId());

    }
    /*
    boolean mForceWidth = false;
    public void setForceWidth(boolean forceWidth) {
        mForceWidth = forceWidth;
    }

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        if(mForceWidth) {
            setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), getMeasuredHeight());
        }
    };
    */


    public void applyTheme(Theme t) {

        Log.d(THIS_FILE, "Theming in progress");
        for(int buttonId : DIGITS_BTNS.keySet()) {

            ImageButton b = findViewById(buttonId);
            // We need to use state list as reused
            t.applyBackgroundStateListDrawable(b, "btn_dial");

            // Src of button
            Drawable src = t.getDrawableResource("dial_num_"+DIGITS_NAMES.get(buttonId));
            if(src != null) {
                b.setImageDrawable(src);
            }

            // Padding of button
            t.applyLayoutMargin(b, "dialpad_btn_margin");
        }

    }

}

The dialpad.xml is below.

<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2010 Regis Montoya (aka r3gis - www.r3gis.fr) 

    This file is part of CSipSimple.
    CSipSimple is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    If you own a pjsip commercial license you can also redistribute it
    and/or modify it under the terms of the GNU Lesser General Public License
    as an android library.

    CSipSimple is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with CSipSimple.  If not, see <http://www.gnu.org/licenses/>.
-->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

        <ImageButton
            android:id="@+id/button1"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_one"
            app:srcCompat="@drawable/dial_num_1" />

        <ImageButton
            android:id="@+id/button2"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_two"
            app:srcCompat="@drawable/dial_num_2" />

        <ImageButton
            android:id="@+id/button3"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_three"
            app:srcCompat="@drawable/dial_num_3" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

        <ImageButton
            android:id="@+id/button4"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_four"
            app:srcCompat="@drawable/dial_num_4" />

        <ImageButton
            android:id="@+id/button5"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_five"
            app:srcCompat="@drawable/dial_num_5" />

        <ImageButton
            android:id="@+id/button6"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_six"
            app:srcCompat="@drawable/dial_num_6" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

        <ImageButton
            android:id="@+id/button7"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_seven"
            app:srcCompat="@drawable/dial_num_7" />

        <ImageButton
            android:id="@+id/button8"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_eight"
            app:srcCompat="@drawable/dial_num_8" />

        <ImageButton
            android:id="@+id/button9"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_nine"
            app:srcCompat="@drawable/dial_num_9" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

        <ImageButton
            android:id="@+id/buttonstar"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_star"
            app:srcCompat="@drawable/dial_num_star" />

        <ImageButton
            android:id="@+id/button0"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_zero"
            app:srcCompat="@drawable/dial_num_0" />

        <ImageButton
            android:id="@+id/buttonpound"
            style="@style/DialtactsDialpadButtonStyle"
            android:contentDescription="@string/description_image_button_pound"
            app:srcCompat="@drawable/dial_num_pound" />
    </TableRow>

</TableLayout>

The app that I'm currently upgraded is made by Regis Montoya and I'm sure it works fine.

rmanalo
  • 342
  • 3
  • 23
  • There might be a problem with CSipSimple library, it is obsolete and was abandoned years ago. Look at -> Error inflating class com.csipsimple.widgets.Dialpad before -> Error inflating class android.widget.ImageButton – Ananth Jul 22 '19 at 10:39
  • Yeah, I know. But we currently need it to work on an Oreo device. But Dialpad is just a custom component so I think there's still a way for me to make it work. – rmanalo Jul 24 '19 at 03:00
  • I got an apk from someone in https://github.com/r3gis3r/CSipSimple/issues/69. I tried it on my Oreo device an it worked. I want to decompile it to apply my changes for my use case but can't find a good apk decompiler yet because their result are often not easily converted by Android Studio. – rmanalo Jul 24 '19 at 04:14
  • I tried to decompile this apk. http://server2.internetdsl.pl/CSipSimple.apk I can't seem to make a working source code from it after following this answer. https://stackoverflow.com/a/6081365/10464730 Especially adding gradle to it – rminaj Jul 24 '19 at 08:24
  • could you post R.layout.dialpad. The error says its an unkown attribute you have given for the ImageButton. You seem to be inflating that layout before getting the reference to the view. – Jude Osbert K Jul 25 '19 at 03:13
  • Already added the code – rmanalo Jul 25 '19 at 05:34
  • Can you highlight for me where you call `AppCompact Image Button` On your XML file – BlackBlind Jul 25 '19 at 06:25

1 Answers1

5

I'm pretty sure that your problem in styles(styles.xml).

   <style name="DialtactsDialpadButtonStyle">
        <item name="android:layout_width">0dip</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_weight">1</item>
        <item name="android:background">?attr/actionBarItemBackground</item>
    </style>

Try remove or change line:

<item name="android:background">?attr/actionBarItemBackground</item>

It looks like ?attr/actionBarItemBackground is not found while inflating layout.

Update:

Why it happens and why it is working without fixes on ready apk from https://github.com/r3gis3r/CSipSimple/issues/69 :

In your build ?attr/actionBarItemBackground is not found in theme which is set for ImageButton. This theme is <style name="DarkTheme.Dialog" parent="Theme.Sherlock.Dialog">

Theme.Sherlock.Dialog was defined in JakeWharton's ActionBarSherlock. But it was removed by commit 601bde214b56b8fad0b4fc5aaed5af0b531b6135

So that's why old apk is working fine while new build(which is using "latest" ActionBarSherlock) is crashing.

Community
  • 1
  • 1
Dmitrii Nechepurenko
  • 1,414
  • 1
  • 11
  • 13
  • I also found that a while ago and it did fix the error. Props to you for digging deeper into this. If you could give an explanation to why the previous dev did that and why it doesn't work now, I'll accept your answer. – rmanalo Jul 25 '19 at 06:51