B4A Library [Class] AnotherDatePicker - A simple "web style" date picker

Status
Not open for further replies.

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm getting

java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.CustomViewWrapper
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at java.lang.Class.forName(Class.java:169)
at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:17)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:233)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:273)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:123)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:190)
at b4a.example.main._activity_create(main.java:235)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at b4a.example.main.afterFirstLayout(main.java:89)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: anywheresoftware/b4a/objects/CustomViewWrapper
... 24 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.CustomViewWrapper" on path: DexPathList[[zip file "/data/app/b4a.example-2.apk"],nativeLibraryDirectories=[/data/app-lib/b4a.example-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
... 24 more
main_activity_create (java line: 235)
java.lang.RuntimeException: java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.CustomViewWrapper
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:140)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:190)
at b4a.example.main._activity_create(main.java:235)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at b4a.example.main.afterFirstLayout(main.java:89)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.CustomViewWrapper
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:204)
at java.lang.Class.forName(Class.java:169)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:240)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:273)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:123)
... 17 more
Caused by: java.lang.NoClassDefFoundError: anywheresoftware/b4a/objects/CustomViewWrapper
... 23 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.CustomViewWrapper" on path: DexPathList[[zip file "/data/app/b4a.example-2.apk"],nativeLibraryDirectories=[/data/app-lib/b4a.example-2, /vendor/lib, /system/lib]]


at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
... 23 more
java.lang.RuntimeException: java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.CustomViewWrapper
 

yttrium

Active Member
Licensed User
Longtime User
Hey Erel, any idea on how to disable dates past the current date? For example, if today is the 16th of October, I don't want users to be able to select any dates past the 16th.
 

yttrium

Active Member
Licensed User
Longtime User
For the first case, how could I determine that? DateUtils.PeriodBetweenInDays only returns positive integers.

Should I just compare their tick values? And if so, how can I convert a date (say, 10/16/2013) to ticks?
 
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
how to set the fitst day MONDAY (in spain, the first day on week is MONDAY and the last is SUNDAY).?
 

enrico

Active Member
Licensed User
Longtime User
I'm trying to add this date picker in a project.
I had a label with the date (pic0), but if I add the date picker with :

adpDate.Initialize(Me, "adpDate")
adpDate.AddToActivity(Activity, lblDate)

the label becomes white (pic1 & pic 2) and I don't understand how to keep it transparent

 

enrico

Active Member
Licensed User
Longtime User
I couldn't replicate the problem in a clean project.
Surely it depends on some of my layouts.
I have not been able to solve it and my workaround is to delete this line :

Lbl.Background = et.Background

in the class module.

Another thing is that when I close date picker (with cancel or today), black boxes remains in the buttons place (as you can see in screenshot)

 

shaffnert03

Member
Licensed User
Longtime User
Another problem to consider while working through this. If I try to call the setdate function before I've manually opened and closed the date picker, I hit several unitialized variables (targetLabel, Years, Months) and it fails. This is true even though I've initialized the date picker in my code. Is there a fix for this or something I need to do to avoid it?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem happens because there is a call to AddToActivity in DesignerCreateView that is done with CallSubDelayed. It must use CallSubDelayed because it is not possible to load a layout file while a file is being loaded.

The solution is to use CallSubDelayed in your code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   CallSubDelayed(Me, "SetDate")
End Sub

Sub SetDate
   ADP.SetDate(DateTime.Now, True)
End Sub
 

JTmartins

Active Member
Licensed User
Longtime User
Hello,

Been playing with this class and came across this problem

in my tablet the label with the date apears correctly with 2013/12/18, just as I want, however in my phone the date in the label shows as 2013/12/18 00:00:00.

but this only happens in my app. The sample works OK on the phone and on the tablet

Why is the time coming up only on the phone ? (althoug I do understand that the time is part of the string)

Tablet : Android 4.03
Phone : 4.1.1

B4X:
Log("Cancelled = " & Cancelled & ", Date = " & DateUtils.TicksToString(Date))


    DateTime.DateFormat = "yyyy/MM/dd"
    Label1.Text= DateUtils.TicksToString(Date)
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…