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

[TIMOB-16207] parse string to boolean #5238

Conversation

bijupmb
Copy link
Contributor

@bijupmb bijupmb commented Jan 20, 2014

@@ -386,7 +386,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent)
fireEvent(TiC.EVENT_RETURN, data);
}

Boolean enableReturnKey = (Boolean) proxy.getProperty(TiC.PROPERTY_ENABLE_RETURN_KEY);
Boolean enableReturnKey = Boolean.parseBoolean(proxy.getProperty(TiC.PROPERTY_ENABLE_RETURN_KEY).toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TiConvert.toBoolean().

@@ -386,7 +386,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent)
fireEvent(TiC.EVENT_RETURN, data);
}

Boolean enableReturnKey = (Boolean) proxy.getProperty(TiC.PROPERTY_ENABLE_RETURN_KEY);
Boolean enableReturnKey = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_ENABLE_RETURN_KEY).toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to call .toString(), ToConvert.toBoolean will do it for you. Simply call TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_ENABLE_RETURN_KEY));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@hieupham007
Copy link
Contributor

Code reviewed. Please address comments

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Request accepted

hieupham007 added a commit that referenced this pull request Mar 6, 2014
…owsClassCastException

[TIMOB-16207] parse string to boolean
@hieupham007 hieupham007 merged commit f722a95 into tidev:master Mar 6, 2014
farfromrefug pushed a commit to Akylas/titanium_mobile that referenced this pull request Aug 15, 2014
…ngThrowsClassCastException

[TIMOB-16207] parse string to boolean
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

Successfully merging this pull request may close these issues.

None yet

3 participants