Android Question How to click the button to take a photo and then compress it into the ImageView1 control?

bskotu555

Active Member
The attachment is the source code of the case, only a small part has been made...
 

Attachments

  • Help.zip
    34.3 KB · Views: 71

bskotu555

Active Member
Well, what about a forum search to find [B4X] MediaChooser - cross platform videos and images chooser as a starting point ;).
The current case being tested is this one, but it crashed inexplicably and the cause cannot be found
b4a:
日志记录器已连接到: emulator-5554
--------- beginning of main
--------- beginning of system
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Error occurred on line: 33 (FileProvider)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
    at b4a.example.fileprovider._getfileuri(fileprovider.java:86)
    at b4a.example.mediachooser$ResumableSub_CaptureImage.resume(mediachooser.java:152)
    at b4a.example.mediachooser._captureimage(mediachooser.java:109)
    at b4a.example.b4xmainpage$ResumableSub_Button1_Click.resume(b4xmainpage.java:110)
    at b4a.example.b4xmainpage._button1_click(b4xmainpage.java:84)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:6599)
    at android.view.View.performClickInternal(View.java:6576)
    at android.view.View.access$3100(View.java:780)
    at android.view.View$PerformClick.run(View.java:25899)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6840)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
Caused by: java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority b4a.example.provider
    at androidx.core.content.FileProvider.getFileProviderPathsMetaData(FileProvider.java:664)
    at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:695)
    at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:645)
    at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:449)
    ... 26 more
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
 
Upvote 0

bskotu555

Active Member
Based on this error, I understand that you solved this one: https://www.b4x.com/android/forum/t...ng-the-file-linked-below.166766/#post-1022427
Right? How did you do it? Why aren't you updating that thread?
1745817892048.png
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
It is difficult to understand your log file because I unfortunately cannot read and write in your language.

I advised in you in post 2 to try the program below:
Well, what about a forum search to find [B4X] MediaChooser - cross platform videos and images chooser as a starting point ;).
If you download the program and set the API level in the manifest to 33 it will work, with API 34 it did not work on my phone and tablet.
This solution from aeric solve my problem:
- v1.01 - (B4A) adds support for targetSdkVersion=34. New requirement in manifest editor:

API-34 Manifest addition for MCExample program (ExoPlayer, MediaChooser, SimpleMediaManager) :
SetServiceAttribute(KeepRunningService, android:foregroundServiceType, shortService)

  1. My first question @bskotu555 do you add this line to the manifest file in your [B4X] MediaChooser - cross platform videos and images chooser program, and can you tell me if that program works flawlessly with Your API-34 environment?

  2. My second question @bskotu555 does this addition to your program solve your problem?
 
Upvote 0

bskotu555

Active Member
It is difficult to understand your log file because I unfortunately cannot read and write in your language.

I advised in you in post 2 to try the program below:

If you download the program and set the API level in the manifest to 33 it will work, with API 34 it did not work on my phone and tablet.
This solution from aeric solve my problem:


API-34 Manifest addition for MCExample program (ExoPlayer, MediaChooser, SimpleMediaManager) :
SetServiceAttribute(KeepRunningService, android:foregroundServiceType, shortService)

  1. My first question @bskotu555 do you add this line to the manifest file in your [B4X] MediaChooser - cross platform videos and images chooser program, and can you tell me if that program works flawlessly with Your API-34 environment?

  2. My second question @bskotu555 does this addition to your program solve your problem?
There is no problem with the case. The error was caused by encrypting the compressed files that came with the JDK using the Yisai Tong encryption client on my computer. Later, I solved the problem by decompressing the JDK on other computers without an encryption client, uploading it to Baidu Netdisk, and then downloading the file folder on the encryption client computer
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Have you tried with this example?


You might have to work through the thread go understand the latest changes. It was Activity based before but last update was making use of B4XPages.
 
Upvote 0
Top