Android Question AnotherDatePicker Add

Discussion in 'Android Questions' started by Derek Jee, Jul 18, 2015.

  1. Derek Jee

    Derek Jee Active Member Licensed User

    Hi all

    Can anyone tell me how to add the ADP in code as I can't seem to find any examples. The intro page says it is better to do it in the designer but I have already designed it in code.


    Thank you :)

    Derek.
     
    pesquera likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Something like:
    Code:
    Dim adp3 As AnotherDatePicker
    adp3.Initialize(Me, 
    "adp3")
    adp3.AddToActivity(
    Activity, label1) 'label1 is an existing label
     
    pesquera, DonManfred and Derek Jee like this.
  3. Derek Jee

    Derek Jee Active Member Licensed User

    Thank you Erel :)
     
  4. pesquera

    pesquera Active Member Licensed User

    Hi, I also need to implement this class without the designer.. but, I had not the "AddToActivity" method
    What am I missing?
     

    Attached Files:

    • ADP.png
      ADP.png
      File size:
      7.2 KB
      Views:
      45
  5. DonManfred

    DonManfred Expert Licensed User

    Try
    Code:
    Activity.AddView(adp3,left, top, w, h)
     
    mangojack likes this.
  6. pesquera

    pesquera Active Member Licensed User

    [
    Thanks for your soon response.. but, I got this error:
    java.lang.IllegalArgumentException: method anywheresoftware.b4a.objects.ActivityWrapper.AddView argument 1 has type android.view.View, got agendame.turnos.anotherdatepicker
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Why do you want to add it without the designer? You can create an empty layout with only ADP and add it this way.
     
    pesquera likes this.
  8. pesquera

    pesquera Active Member Licensed User

    I already did the Activity by code, having a button above the list view
    Wanted to show the calendar with that button, then fill that list view with the selected day
    How can I then handle ADP?
    Thanks for your help

    Edited: done! thanks very much.. this code is on the button event
    Code:
    Activity.LoadLayout("1")
    glo_lst_DatePicker = 
    Array(glo_DatePicker1)
    glo_DatePicker1.Show
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Like any other view. Add it with the designer and right click to generate the variable.

    If you want to change its position in your code then you will need to make targetLabel a public variable and then do something like:
    Code:
    Dim p As Panel = ADP.targetLabel.Parent
    Now you can move p as needed.
     
Loading...