Android Question SMM question

Almora

Well-Known Member
Licensed User
Longtime User
hi
I'm capturing a screenshot.
when I capture a new screenshot it still shows the old one.
How can I fix.

B4X:
Sub Button1_Click
        ............
        bitmap1.Initialize3(vv.TakeScreenshot)      
        Dim Out As OutputStream
        Out = File.OpenOutput(dir, "image.jpg", False)
        bitmap1.WriteToStream(Out, 100, "JPEG")
        Out.Close
       
    MediaManager.SetMediaFromFile(Panel2, dir, "image.jpg","image/*", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
  End Sub

i tried this but it still shows the old image.
B4X:
MediaManager.ClearMedia(Panel2)

thanks..
 

Almora

Well-Known Member
Licensed User
Longtime User
Try this:


I used MediaReady. the result did not change.
I'm capturing a video screenshot. when I capture it again it doesn't show the new screenshot. shows the previous screenshot
 
Upvote 0

Almora

Well-Known Member
Licensed User
Longtime User
Uploading samples is a big deal.


B4X:
Sub Capture_Click
        ............
        bitmap1.Initialize3(vv.TakeScreenshot)     
        Dim Out As OutputStream
        Out = File.OpenOutput(dir, "image.jpg", False)
        bitmap1.WriteToStream(Out, 100, "JPEG")
        Out.Close
      
    MediaManager.SetMediaFromFile(Panel2, dir, "image.jpg","image/*", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
  End Sub
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
Uploading samples is a big deal.


B4X:
Sub Capture_Click
        ............
        bitmap1.Initialize3(vv.TakeScreenshot)    
        Dim Out As OutputStream
        Out = File.OpenOutput(dir, "image.jpg", False)
        bitmap1.WriteToStream(Out, 100, "JPEG")
        Out.Close
     
    MediaManager.SetMediaFromFile(Panel2, dir, "image.jpg","image/*", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
  End Sub
Then try this:

B4X:
sleep(100)
MediaManager.SetMediaFromFile(Panel2, dir, "image.jpg","image/*", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
 
Upvote 0

Almora

Well-Known Member
Licensed User
Longtime User
Can you upload an example?

Example project with webview. It takes a screenshot but if I want to take it again when I scroll down to the bottom of the page, it doesn't refresh. Shows the previous picture.
 

Attachments

  • web.zip
    9.4 KB · Views: 110
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should switch to B4XPages. You are not handling the activities life cycle correctly.
2. There is no good reason to use GetSafeDirDefaultExternal. Use XUI.DefaultFolder / File.DirInternal

One of the features of SMM is that it manages a sophisticated images cache. It will not load the image again unless you change the image name or disable the cache.

Disabling the cache is done with:
B4X:
MediaManager.Initialize
MediaManager.MaxMediaCacheSize = 0
And:
B4X:
MediaManager.ClearMedia(Panel1)
MediaManager.TrimMediaCache
MediaManager.SetMediaFromFile(Panel1, dir, "image.png", "image/*", Null)
 
Upvote 0
Top