Android Question another date picker. attempt to invoke method on null object

Discussion in 'Android Questions' started by le_toubib, Mar 10, 2015.

  1. le_toubib

    le_toubib Active Member Licensed User

    hi falks
    i'm trying to implement another date picker in a project.
    it works perfectly ok ,
    however , on the FIRST run on any device , i get this error :



    if i close it and rerun , it shows perfectly thereafter.. the error is replicated on Same device if i uninstall/reinstall


    what am i doing wrong ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the code in Activity_Create?
     
  3. le_toubib

    le_toubib Active Member Licensed User

    here it is
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Have you tested it in Release mode? Did it happen as well?
     
  5. le_toubib

    le_toubib Active Member Licensed User

    Yes, and replicable on any device, only on first run
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Not sure why it happens with this code. You can however remove ADP from the layout file and manually add it in Activity_Resume. It will fix this issue.

    Make sure not to add it multiple times. Only add it if ADP.IsInitialized is false.
     
  7. le_toubib

    le_toubib Active Member Licensed User

    Aha, i thanks for this solution
     
  8. Mahares

    Mahares Well Known Member Licensed User

    When you post code for users to help you with, you should leave it there even after you were provided a solution. It may help someone else in the future. You should not remove it, just because your problem is solved. if you expect help from others, you should also give help.
     
    DonManfred likes this.
  9. le_toubib

    le_toubib Active Member Licensed User

    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        Activity.LoadLayout("1")
        SetTiledBackground(pnl_inputdata,
    LoadBitmap(File.DirAssets,"tile82x82.png"))
        SetTiledBackground(pnl_preview,
    LoadBitmap(File.DirAssets,"tile82x82.png"))
        SetTiledBackground(pnl_print,
    LoadBitmap(File.DirAssets,"tile82x82.png"))
        
    'SetTiledBackground(pnl_settings,LoadBitmap(File.DirAssets,"tile82x82.png"))

        
    If FirstTime Then
            
    SMTP.Initialize("smtp.gmail.com"587"""""SMTP")
            
    SMTP.StartTLSMode = True
        
    End If
        WebView1.Initialize(
    "webview1")

        pnl_preview.AddView(WebView1,
    0,0,550dip,90%y)

        lst_prev_names.Initialize
        lst_places.Initialize
        lst_sources.Initialize

        readcomments
      

    If File.Exists(File.DirRootExternal & dirname, "settings.ini"Then  
        readsettings
        readplaces
    Else
        
    File.MakeDir(File.DirRootExternal,dirname)
        readsettings
        readplaces
    End If

    savesettings
        
    DateTime.DateFormat="dd-MM-yyyy"

        acet1.SetItems(lst_prev_names)
        acet2.SetItems(lst_places)
        createlabelsandspinners
      
        lbl_date.Text=lbl_date.Text & 
    DateTime.Date(DateTime.Now)
        spn_test_type.Add(
    "WISC")
        spn_test_type.Add(
    "WAIS")
        spn_test_type.SelectedIndex=
    0

        
    'spn_test_type.Background=b_share.Background




    End Sub

    sure mate
     
    Last edited by a moderator: Mar 12, 2015
    DonManfred likes this.
  10. Erel

    Erel Administrator Staff Member Licensed User

    I removed the SMTP account information from the code...
     
  11. le_toubib

    le_toubib Active Member Licensed User

    Thanks erel
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice