MaskedEditText Use View.isInEditMode ()

I am getting below error when using maskedEditText :

enter image description here

I downloaded the library, then click File-> New-> Other-> Android project from existing Code-> Add folder, checked copy project to workspace

Then I added the library folder to my project:

enter image description here

And when I run I have a ClassNotFoundException

my xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:mask="http://schemas.android.com/apk/res/com.example.pppp"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.pppp.MainActivity" >

    <br.com.sapereaude.maskedEditText.MaskedEditText 
                        android:id="@+id/phoneNumber"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="3dp"
                        android:background="@null"
                        android:inputType="number"
                        mask:mask="(###) ###-##-##"
                    >
                    </br.com.sapereaude.maskedEditText.MaskedEditText>

</RelativeLayout>

      

Errors

05-30 10:10:38.423: E/AndroidRuntime(32526): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pppp/com.example.pppp.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class br.com.sapereaude.maskedEditText.MaskedEditText
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.os.Looper.loop(Looper.java:154)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread.main(ActivityThread.java:4624)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at java.lang.reflect.Method.invokeNative(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at java.lang.reflect.Method.invoke(Method.java:511)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at dalvik.system.NativeStart.main(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class br.com.sapereaude.maskedEditText.MaskedEditText
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.createView(LayoutInflater.java:608)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at com.example.pppp.MainActivity.onCreate(MainActivity.java:13)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.Activity.performCreate(Activity.java:4479)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
05-30 10:10:38.423: E/AndroidRuntime(32526):    ... 11 more
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: java.lang.reflect.InvocationTargetException
05-30 10:10:38.423: E/AndroidRuntime(32526):    at java.lang.reflect.Constructor.constructNative(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-30 10:10:38.423: E/AndroidRuntime(32526):    at android.view.LayoutInflater.createView(LayoutInflater.java:588)
05-30 10:10:38.423: E/AndroidRuntime(32526):    ... 22 more
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: java.lang.NoClassDefFoundError: br.com.sapereaude.maskedEditText.R$styleable
05-30 10:10:38.423: E/AndroidRuntime(32526):    at br.com.sapereaude.maskedEditText.MaskedEditText.<init>(MaskedEditText.java:43)

      

+3


source to share


1 answer


Try changing the namespace to "MaskedEditText.MaskedEditText". We can see the namespace in "References / MaskedEditText". Example :



        <MaskedEditText.MaskedEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                mask:mask="+# (###) ##-##"
                android:id="@+id/email" />

      

0


source







All Articles