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: Copy
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: Copy
MediaManager.ClearMedia(Panel2)

thanks..
 
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
Uploading samples is a big deal.


B4X: Copy
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
Uploading samples is a big deal.


B4X: Copy
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: Copy
sleep(100)
MediaManager.SetMediaFromFile(Panel2, dir, "image.jpg","image/*", CreateMap(MediaManager.REQUEST_ZOOMIMAGEVIEW: True))
 
Upvote 0
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

Upvote 0
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:
Code: Copy
MediaManager.Initialize
MediaManager.MaxMediaCacheSize = 0
And:
Code: Copy
MediaManager.ClearMedia(Panel1)
MediaManager.TrimMediaCache
MediaManager.SetMediaFromFile(Panel1, dir, "image.png", "image/*", Null)
 
Upvote 0
Back
Top