Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard error #17

Closed
NilakArgento opened this issue Sep 18, 2015 · 8 comments
Closed

Keyboard error #17

NilakArgento opened this issue Sep 18, 2015 · 8 comments

Comments

@NilakArgento
Copy link

When i try to type something i have app crash
In logs :

java.lang.ClassCastException: android.support.v7.internal.view.ContextThemeWrapper cannot be cast to com.vijay.jsonwizard.interfaces.JsonApi
            at com.vijay.jsonwizard.customviews.GenericTextWatcher.afterTextChanged(GenericTextWatcher.java:37)
            at android.widget.TextView.sendAfterTextChanged(TextView.java:7247)
            at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:8891)
            at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:970)
            at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:497)
            at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
            at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
            at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:222)
            at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
            at android.widget.TextView.doKeyDown(TextView.java:5385)
            at android.widget.TextView.onKeyDown(TextView.java:5204)
            at android.view.KeyEvent.dispatch(KeyEvent.java:2609)
            at android.view.View.dispatchKeyEvent(View.java:7205)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.widget.ScrollView.dispatchKeyEvent(ScrollView.java:353)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1359)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1920)
            at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1395)
            at android.app.Activity.dispatchKeyEvent(Activity.java:2370)
            at android.support.v7.internal.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:49)
            at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:258)
            at android.support.v7.internal.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:49)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1847)
            at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3701)
            at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3651)
            at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2818)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)
@NilakArgento
Copy link
Author

I'm using


    compile 'com.github.vijayrawatsan:android-json-form-wizard:+'

@vijayrawatsan
Copy link
Owner

Can you try latest dependency
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.vijayrawatsan:android-json-form-wizard:1.1.1-SNAPSHOT'
}

@NilakArgento
Copy link
Author

Doesn't work )

@NilakArgento
Copy link
Author

What can be the problem ?!

@vijayrawatsan
Copy link
Owner

You tried to run the demo and it didnt work?

@NilakArgento
Copy link
Author

Demo works fine.

My build

apply plugin: 'com.android.application'

android {
    signingConfigs {
    }
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId 'us.ethnicmedia.sevendays'
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 12
        versionName '2.1'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}
repositories {
    maven { url "https://jitpack.io" }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:cardview-v7:21.+'
    compile 'com.android.support:recyclerview-v7:21.+'
    compile('com.mikepenz.materialdrawer:library:2.0.2@aar') {
        transitive = true
    }
    compile 'com.etsy.android.grid:library:1.0.5'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    compile files('libs/volley.jar')
    compile 'com.github.vijayrawatsan:android-json-form-wizard:1.1.1-SNAPSHOT'

}

@vijayrawatsan
Copy link
Owner

Possibly
tintContextWrapper.getBaseContext() is returning a ContextWrapper somehow for your case instead of activity(which implements JsonApi)

Change below line
api = (JsonApi) tintContextWrapper.getBaseContext();

to

Object obj = tintContextWrapper.getBaseContext();
if( obj instanceof JsonApi) {
api= (JsonApi)obj;
}
if (obj instanceof ContextThemeWrapper) {
api = (JsonApi) ((ContextThemeWrapper)obj).getBaseContext();
}

@vijayrawatsan
Copy link
Owner

@NilakArgento I think this is fixed for you. It would be nice if you could send a pr for the above code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants