#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
'MUST CHANGE PATH OF AAR HERE
#AdditionalJar:C:\Users\Administrator\Desktop\B4AWrapper\B4ASimpleDatePicker\singledateandtimepicker-2.2.8.aar
#Extends: android.support.v7.app.AppCompatActivity
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
Dim nt As JavaObject
nt.InitializeContext
nt.RunMethod("showdatepicker",Null)
End Sub
Sub datepick_selected(datereturn As String)
Log(datereturn)
End Sub
#IF JAVA
import com.github.florent37.singledateandtimepicker.dialog.SingleDateAndTimePickerDialog;
import com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker;
import java.util.Date;
public void showdatepicker(){
new SingleDateAndTimePickerDialog.Builder(this)
//.bottomSheet()
//.curved()
//.stepSizeMinutes(15)
//.displayHours(false)
//.displayMinutes(false)
//.todayText("aujourd'hui")
.displayListener(new SingleDateAndTimePickerDialog.DisplayListener() {
@Override
public void onDisplayed(SingleDateAndTimePicker picker) {
// Retrieve the SingleDateAndTimePicker
}
@Override
public void onClosed(SingleDateAndTimePicker picker) {
// On dialog closed
}
})
.title("Simple")
.listener(new SingleDateAndTimePickerDialog.Listener() {
@Override
public void onDateSelected(Date date) {
// processBA.raiseEventFromDifferentThread(null, null, 0, "datepick_selected", false, null);
processBA.raiseEventFromDifferentThread(null, null, 0,"datepick_selected", false, new Object[] {String.valueOf(date)});
}
}).display();
}
#End If