Android Question How to make the initialized BMP images dissapear?

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?
 

Attachments

  • FYP 2015 Version 1.zip
    45 KB · Views: 43

fixit30

Active Member
Licensed User
Ok, two issues that I can see.

You Initialize the ImageView that was added by the designer.
B4X:
imvonewaydetailing.Initialize("emptybmp")

And you then re-add the Imageview to the activity rather than using the one created in the designer.
B4X:
Activity.AddView(imvonewaydetailing, x, y, wc, hc)
 
Upvote 0

iamfanghan

Member
Licensed User
Ok, two issues that I can see.

You Initialize the ImageView that was added by the designer.
B4X:
imvonewaydetailing.Initialize("emptybmp")

And you then re-add the Imageview to the activity rather than using the one created in the designer.
B4X:
Activity.AddView(imvonewaydetailing, x, y, wc, hc)
So what can I do to correct that mistake sir?
 
Upvote 0

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.

B4X:
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
 
Upvote 0

iamfanghan

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.

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