Android Question How to make the initialized BMP images dissapear?

Discussion in 'Android Questions' started by iamfanghan, Apr 9, 2015.

  1. iamfanghan

    iamfanghan Member Licensed User

    There is 2 parts where I called for the BMP images. They would stay there and will not go away even if switched tab. Can any master help me on this?
     

    Attached Files:

  2. fixit30

    fixit30 Active Member Licensed User

    Ok, two issues that I can see.

    You Initialize the ImageView that was added by the designer.
    Code:
    imvonewaydetailing.Initialize("emptybmp")
    And you then re-add the Imageview to the activity rather than using the one created in the designer.
    Code:
    Activity.AddView(imvonewaydetailing, x, y, wc, hc)
     
  3. iamfanghan

    iamfanghan Member Licensed User

    So what can I do to correct that mistake sir?
     
  4. fixit30

    fixit30 Active Member Licensed User

    Delete these two lines. Or comment them out!
     
  5. iamfanghan

    iamfanghan Member Licensed User

    Error occured when i remove that 2 lines...
    "Object should first be initialized"
     
  6. fixit30

    fixit30 Active Member Licensed User

    The following code works for me, notice the commented out lines that were not needed and code modified to reuse the same ImageView.

    Code:
    Sub simplydetail_Click
       
        onewaydetailing.Initialize(
    File.DirAssets,"onewayslabdetailing.bmp")
        
    'imvonewaydetailing.Initialize("emptybmp")
        imvonewaydetailing.Bitmap = onewaydetailing
       
    '    Dim x, y, wc, hc As Float
    '   
    '    wc = onewaydetailing.width * 100dip /100
    '    hc = onewaydetailing.Height * 100dip /100
    '    x = (100%x - wc)/3
    '    y = (100%y - hc)/3.5
       
        
    'Activity.AddView(imvonewaydetailing, x, y, wc, hc)
       
        simplydetailingdetails.AddTextItem(
    "1. H"& maindiameter.Text & " - " & mainspacing.Text,"1")
        simplydetailingdetails.AddTextItem(
    "2. H"& secondarydiameter.Text & " - " & secondaryspacing.Text,"2")
       
    End Sub
    Sub continuousdetail_Click
       
        continuousdetailing.Initialize(
    File.DirAssets,"continuousdetailing.bmp")
        
    'imvcontinuousdetailing.Initialize("")

        
    'below changed to imvonewaydetailing
        imvonewaydetailing.Bitmap = continuousdetailing
       
    '    Dim x, y, wc, hc As Float
    '   
    '    wc = continuousdetailing.width * 100dip /100
    '    hc = continuousdetailing.Height * 100dip /100
    '    x = (100%x - wc)/3
    '    y = (100%y - hc)/3.5
       
        
    'Activity.AddView(imvcontinuousdetailing, x, y, wc, hc)
       
        simplydetailingdetails.AddTextItem(
    "1. H" & nearmiddleendspanbar.Text & " - " & nearmiddleendspanbarspacing.Text, "1")
        simplydetailingdetails.AddTextItem(
    "2. H" & firstinteriorsupportbar.Text & " - " & firstinteriorsupportbarspacing.Text, "2")
        simplydetailingdetails.AddTextItem(
    "3. H" & interiorsupportandspanbar.Text & " - " & interiorsupportandspanbarspacing.Text, "3")
        simplydetailingdetails.AddTextItem(
    "4. H" & interiorsupportandspanbar.Text & " - " & interiorsupportandspanbarspacing.Text, "4")
        simplydetailingdetails.AddTextItem(
    "5. H" & outersupportbar.Text & " - " & outersupportbarspacing.Text, "5")
        simplydetailingdetails.AddTextItem(
    "6. H" & secondarydiameter.Text & " - " & secondaryspacing.Text, "6")
        simplydetailingdetails.AddTextItem(
    "7. H" & secondarydiameter.Text & " - " & secondaryspacing.Text, "7")
        simplydetailingdetails.AddTextItem(
    "8. H" & secondarydiameter.Text & " - " & secondaryspacing.Text, "8")
        simplydetailingdetails.AddTextItem(
    "9. H" & secondarydiameter.Text & " - " & secondaryspacing.Text, "9")
        simplydetailingdetails.AddTextItem(
    "10. H" & secondarydiameter.Text & " - " & secondaryspacing.Text, "10")
       
    End Sub
     
    Roger Daley and iamfanghan like this.
  7. iamfanghan

    iamfanghan Member Licensed User

    Yea it works like a charm! Thx mate :D
     
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