android-times-square
android-times-square copied to clipboard
Add isInEditMode checks for preview rendering.
Hey people!
I am trying to use TimesSquare but am getting a NullPointerException in a simple preview from Android Studio like:
Looking through the code it seems a bit strange that it should be working...
This code seems like will always throw a null pointer exception but I may be mistaken...
The layout file I am trying to preview is:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.squareup.timessquare.CalendarPickerView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
When I run it the app crashes just the same.
Am I missing something? Thanks in advance
Are you initializing the calendar? See the README for an example of calling init
Yeah... I missed it... Sorry for the inconvenience! But that means it won't be able to preview in Studio right?
We can add some isInEdit checks for reasonable preview rendering. On Jan 28, 2015 10:30 AM, "Victor Oliveira Nascimento" < [email protected]> wrote:
Yeah... I missed it... Sorry for the inconvenience! But that means it won't be able to preview in Studio right?
— Reply to this email directly or view it on GitHub https://github.com/square/android-times-square/issues/176#issuecomment-71888395 .
That would help :+1:
Re-purposed the issue for that task.
Hi :) So, any progress with that? I have problems with previewing layout in AS (did not check eclipse), if there is CalendarPickerView dropped onto layout.
Hello again. Few months ago I just threw away this component. Now took that again, and still problems with rendering. AS, API17 rendered, gradle imported 1.6.4 version.
java.lang.IllegalArgumentException: Illegal pattern character 'L'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:845)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:659)
at java.text.SimpleDateFormat.
Found that in google: https://code.google.com/p/android/issues/detail?id=75940
So how are you guys using this component?
@glebsts you're just talking about issues with previewing a CalendarPickerView in Android Studio, right?
I am just trying to figure out if something was fixed or is going to be fixed :) Yes, issue with preview in AS.
No changes have been made on this issue. PRs welcome if you really need AS preview (most of us at Square don't use it).
Well, I thought idea is to provide a component that works in any conditions :) You could at least make a note in readme if you put it into public.... or at least make some statements here in github discussions :) Your component is considered the best across the internets, I was hoping you might be interested in keeping perfect reputation :) So far I work-arounded that by hiding component and setting visibility in run-time, but you know, sometimes it is nice to see how your layout will look like :D Thank you for your answer anyway! Are you using Eclipse?