Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Application Crash after strating the Activity io.card.payment.CardIOActivity; #44

Closed
dhannajha opened this issue Feb 11, 2015 · 19 comments

Comments

@dhannajha
Copy link

These steps are followed by me..

  1. classes.jar from cardio-4.0.0.aar
  2. rename "classes.jar" to "card.io.jar", and copy jar into libs
  3. Calling it from MainActivity's button click :-
    Intent scanIntent = new Intent(this, CardIOActivity.class);
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: true
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false);
    scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); 
    scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
startActivityForResult(scanIntent, 100);

error page

error1

@braebot
Copy link
Member

braebot commented Feb 11, 2015

Thank you for reporting this. Would you mind pasting the contents of the entire stack trace? The important part got cutoff at the bottom of your screenshot.

@dhannajha
Copy link
Author

please find complete stack trace..

02-13 10:25:15.304: E/AndroidRuntime(19211): FATAL EXCEPTION: main
02-13 10:25:15.304: E/AndroidRuntime(19211): Process: com.test.testcardio, PID: 19211
02-13 10:25:15.304: E/AndroidRuntime(19211): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.testcardio/io.card.payment.DataEntryActivity}: java.lang.NullPointerException
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.os.Handler.dispatchMessage(Handler.java:102)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.os.Looper.loop(Looper.java:136)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread.main(ActivityThread.java:5001)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at java.lang.reflect.Method.invokeNative(Native Method)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at java.lang.reflect.Method.invoke(Method.java:515)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at dalvik.system.NativeStart.main(Native Method)
02-13 10:25:15.304: E/AndroidRuntime(19211): Caused by: java.lang.NullPointerException
02-13 10:25:15.304: E/AndroidRuntime(19211):    at io.card.payment.ui.ActivityHelper.setupActionBar(ActivityHelper.java:65)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at io.card.payment.ui.ActivityHelper.setupActionBarIfSupported(ActivityHelper.java:50)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at io.card.payment.DataEntryActivity.onCreate(DataEntryActivity.java:377)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.Activity.performCreate(Activity.java:5231)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-13 10:25:15.304: E/AndroidRuntime(19211):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
02-13 10:25:15.304: E/AndroidRuntime(19211):    ... 11 more

@braebot
Copy link
Member

braebot commented Feb 13, 2015

Thanks for providing the full stack trace. Hmm, the ActionBar object is null. What device OS are you testing on? Are you able to run the Gradle sample app successfully on the same device?

@dhannajha
Copy link
Author

Android-21; I don't know about Gradle sample app.

@braebot
Copy link
Member

braebot commented Feb 13, 2015

Can you provide more details about the device, including the manufacturer, model number, OS, etc... Also, installing the sample gradle app would really help us nail down this issue. The instructions should be contained within the sample app itself.

@9992800
Copy link

9992800 commented Feb 16, 2015

Hello, I have the same problem, Maybe It's about some settings in xml file or layout file.

@9992800
Copy link

9992800 commented Feb 16, 2015

I think The problem may be related with this setting.

<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

@dhannajha
Copy link
Author

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="card.io example"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="card.io example" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" android:hardwareAccelerated="true"/>
    <activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>

</application>

@ramabit
Copy link

ramabit commented Feb 17, 2015

I had the same problem, I think it's not working fine with your current theme.
Just delete the line of keeping the application theme.

@braebot
Copy link
Member

braebot commented Feb 18, 2015

Does your theme disable the ActionBar? If so, this would explain the NPE. This should be a simple to check if the ActionBar is not null as a means to see if the ActionBar is supported here. Until we fix this, the temporary workaround is removing the following line (or setting to false):

// matches the theme of your application
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true); // default: false

@braebot
Copy link
Member

braebot commented Feb 23, 2015

I reproduced this by turning off the action bar in my application's theme. The issue has been corrected in 4.0.2+. In addition, a few more UI elements are colored to match the application's theme.

@braebot braebot closed this as completed Feb 23, 2015
@chezhong
Copy link

chezhong commented Jun 2, 2015

@braebot I tried to change the background color of the ActionBar to white, but unfortunately can't make it work. Could you kindly guide me what's the correct way to do it. Many Thanks!

  1. scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
  2. in my style file <style name="myActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> @color/white </style>

@chezhong
Copy link

chezhong commented Jun 2, 2015

@braebot continue to previous message. How to change the EditText hint text color?
"@color/text_gray"
This has no effect.

Also, please see the screenshot below, the height of the left 'Done' button is not in the same size of the right one. How can we change the layout of the button? Thanks!

screen shot 2015-06-02 at 10 49 53 pm

@dhannajha
Copy link
Author

For change the EditText hint text color, use :

*android:textColorHint="#FFFFFF" *

Example : -

On Tue, Jun 2, 2015 at 8:26 PM, chezhong notifications@github.com wrote:

@braebot https://github.com/braebot continue to previous message. How
to change the EditText hint text color?
@color/text_gray
This has no effect.

Also, please see the screenshot below, the height of the left 'Done'
button is not in the same size of the right one. How can we change the
layout of the button? Thanks!

[image: screen shot 2015-06-02 at 10 49 53 pm]
https://cloud.githubusercontent.com/assets/2390107/7938881/8030dd48-097a-11e5-84b9-f813522c4225.png


Reply to this email directly or view it on GitHub
#44 (comment)
.

@chezhong
Copy link

chezhong commented Jun 3, 2015

@dhannajha thanks for your reply. But I don't see the possibility to change the layout in card-io SDK. Please kindly share with us if you can.

@braebot is there a way to change the layout of the DataEntryActivity from my project. I think the only way is to change source in the project card.io-Android-source, right?

@braebot
Copy link
Member

braebot commented Jun 4, 2015

The hint should be coming from the theme if you're using EXTRA_KEEP_APPLICATION_THEME. We don't actually set the hint color anywhere in that activity. Are you changing the hint color of the theme?

Also, the regarding the button size, it is actually intended to have a border for the 'selected' button, for use in consoles with controllers. I agree that there is definitely room for improvement. You're welcome to poke at the source to change this up a bit, and submit a Pull Request.

@chezhong
Copy link

chezhong commented Jun 6, 2015

@braebot Thanks for your reply. We are rush to release this time, so I just hide the confirmation page for now. I will checkout the source code of the library and to see how can I improve the UIs later. But many thanks for your GREAT library. It works very well so far.

P.S. You can close this issue.

@eliasbagley
Copy link

I have the same issue as above. I am setting the Card.io Intent extra to use my App's theme, but my theme's value of <item name="android:textColorHint">#FF0000</item> is ignored by Card.io's manual entry edit texts. No matter what I set in my theme, the manual entry EditText hint color stays white.

@braebot
Copy link
Member

braebot commented Mar 4, 2016

@eliasbagley, ah ha! Let's use card-io/card.io-Android-source#59 to track progress regarding the hint color.

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

No branches or pull requests

6 participants