user2659110
user2659110

Reputation:

Android app crashes when long press on edit view

I'm a newbie in Android and working on my first app.I have the main activity(login activity ) with no ActionBar and remaining all activities with action bar. When I long press on edit text , app crashes with below mentioned logcat . I can't figure out what's the cause of this error. Please help me to locate it.

 09-28 14:45:26.871  22863-22863/com.abc.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
 Process: com.abc.app, PID: 22863
 android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:620)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
    at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3100)
    at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2313)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3310)
    at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3602)
    at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3829)
    at android.widget.Editor.performLongClick(Editor.java:859)
    at android.widget.TextView.performLongClick(TextView.java:8666)
    at android.view.View$CheckForLongPress.run(View.java:18677)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5257)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
    at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3100)
    at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2313)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3310)
    at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3602)
    at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3829)
    at android.widget.Editor.performLongClick(Editor.java:859)
    at android.widget.TextView.performLongClick(TextView.java:8666)
    at android.view.View$CheckForLongPress.run(View.java:18677)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5257)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=687
    at android.content.res.StringBlock.get(StringBlock.java:65)
    at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:721)
    at android.content.res.TypedArray.getString(TypedArray.java:125)
    at android.widget.TextView.<init>(TextView.java:1049)
    at android.widget.TextView.<init>(TextView.java:635)
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
    at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3100)
    at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2313)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3073)
    at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3310)
    at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3602)
    at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3829)
    at android.widget.Editor.performLongClick(Editor.java:859)
    at android.widget.TextView.performLongClick(TextView.java:8666)
    at android.view.View$CheckForLongPress.run(View.java:18677)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5257)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteI`enter code here`nit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
    at dalvik.system.NativeStart.main(Native Method)

MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActionBar().hide();
    setContentView(R.layout.activity_main);
}

activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/activity_background"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
tools:context=".MainActivity">


<ImageView
    android:id="@+id/loginImageView"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="-2dp"
    android:layout_marginTop="-12dp"
    android:src="@drawable/login_screen" />

<EditText
    style="@style/LoginEditTxt"
    android:id="@+id/userMail"
    android:layout_below="@+id/loginImageView"
    android:layout_marginBottom="10dp"
    android:layout_marginTop="20dp"
    android:ems="10"
    android:hint="@string/hint_user_name"
    android:inputType="textEmailAddress"
    android:textAlignment="center"
    /></LinearLayout>

Upvotes: 1

Views: 1661

Answers (1)

daemmie
daemmie

Reputation: 6460

I guess there is something wrong with your style or your Theme.

I suggest to remove the style and try it. If it works, you should find out which value causes the problem and open up a new question.

This SO Answer also might help you.

It seems some font Families cause crashes.

Upvotes: 2

Related Questions