[
https://issues.apache.org/jira/browse/CB-11078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15397211#comment-15397211
]
ASF GitHub Bot commented on CB-11078:
-------------------------------------
Github user akilawickey commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/316#discussion_r72578371
--- Diff: framework/src/org/apache/cordova/CordovaActivity.java ---
@@ -175,9 +175,13 @@ protected void createViews() {
setContentView(appView.getView());
if (preferences.contains("BackgroundColor")) {
- int backgroundColor =
preferences.getInteger("BackgroundColor", Color.BLACK);
- // Background of activity:
- appView.getView().setBackgroundColor(backgroundColor);
+ try {
+ int backgroundColor =
preferences.getInteger("BackgroundColor", Color.BLACK);
+ // Background of activity:
+ appView.getView().setBackgroundColor(backgroundColor);
+ }catch (NumberFormatException e){
+ System.out.println(e.getMessage());
--- End diff --
Ok i'll make the changes
On Thu, Jul 28, 2016 at 12:41 PM, jcesarmobile <[email protected]>
wrote:
> In framework/src/org/apache/cordova/CordovaActivity.java
> <https://github.com/apache/cordova-android/pull/316#discussion_r72573856>:
>
> > @@ -175,9 +175,13 @@ protected void createViews() {
> > setContentView(appView.getView());
> >
> > if (preferences.contains("BackgroundColor")) {
> > - int backgroundColor =
preferences.getInteger("BackgroundColor", Color.BLACK);
> > - // Background of activity:
> > - appView.getView().setBackgroundColor(backgroundColor);
> > + try {
> > + int backgroundColor =
preferences.getInteger("BackgroundColor", Color.BLACK);
> > + // Background of activity:
> > + appView.getView().setBackgroundColor(backgroundColor);
> > + }catch (NumberFormatException e){
> > + System.out.println(e.getMessage());
>
> Can you use e.printStackTrace(); instead of System.out?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
>
<https://github.com/apache/cordova-android/pull/316/files/1be6ae190cc5804ae73a12044d184e72bc026f9e#r72573856>,
> or mute the thread
>
<https://github.com/notifications/unsubscribe-auth/AKzUNOndsuxrQa3NLQc7zyXXlN1TZYWTks5qaFYugaJpZM4JLF9t>
> .
>
--
*Thanks and Regards,*Akila Wickramarachchi
Undergraduate at University Of Peradeniya
<https://www.linkedin.com/profile/view?id=AAMAABg_m_sBqt7aECwMPaTfYpf-olFytcSylC4&trk=hp-identity-headline>
Email : [email protected]
Linkedin : Akila Wickramarachchi
<https://www.linkedin.com/profile/view?id=AAMAABg_m_sBqt7aECwMPaTfYpf-olFytcSylC4&trk=hp-identity-name>
Blog : http://akilacollection.blogspot.com/
Github : https://github.com/akilawickey
> Empty string for BackgroundColor preference crashes application
> ---------------------------------------------------------------
>
> Key: CB-11078
> URL: https://issues.apache.org/jira/browse/CB-11078
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Environment: HTC One
> Android 6.0
> Cordova-Android 5.1.0
> Reporter: Ryan Willoughby
> Assignee: Jesse MacFadyen
> Priority: Minor
> Labels: easyfix, triaged
>
> A preference of
> {{<preference name="BackgroundColor" value="" />}}
> will cause an a cordova application to crash on startup with a
> NumberFormatException:
> {color:red}
> 04-13 11:18:29.894: E/AndroidRuntime(20224): java.lang.RuntimeException:
> Unable to start activity
> ComponentInfo{com.whatever.whatever/com.whatever.whatever.ClassName}:
> java.lang.NumberFormatException: Invalid long: ""
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread.access$900(ActivityThread.java:150)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.os.Handler.dispatchMessage(Handler.java:102)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.os.Looper.loop(Looper.java:168)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread.main(ActivityThread.java:5845)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> java.lang.reflect.Method.invoke(Native Method)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): Caused by:
> java.lang.NumberFormatException: Invalid long: ""
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> java.lang.Long.invalidLong(Long.java:124)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> java.lang.Long.decode(Long.java:142)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> org.apache.cordova.CordovaPreferences.getInteger(CordovaPreferences.java:78)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> org.apache.cordova.CordovaActivity.createViews(CordovaActivity.java:178)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> org.apache.cordova.CordovaActivity.init(CordovaActivity.java:142)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:214)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> uk.directpath.staffssmartalert2.StaffsSmartAlertv2.onCreate(StaffsSmartAlertv2.java:32)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.Activity.performCreate(Activity.java:6248)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
> 04-13 11:18:29.894: E/AndroidRuntime(20224): ... 9 more
> {color}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]