Android Tutorial Intent Based Camera

Newer example: [B4X] [B4XPages] Intent based camera

This example uses an intent to take a picture with the default camera app.

It is based on this tutorial: https://developer.android.com/training/camera/photobasics.html

It is simple to use and doesn't require any permission (*).

It does rely on the default camera app to work properly and save the image file in the path passed in the intent.
As a fallback, if the image was not saved it tries to get the thumbnail from the intent returned.

Don't miss the manifest editor code that is required for sharing file uris.
 

Attachments

  • CameraIntent.zip
    9.5 KB · Views: 1,686
Last edited:

winiha

Member
Licensed User
You just have to change the "/DCIM/Camera" folder to your folder.
as i understood Erel's code, it probably works but you copy tempimage.jpg from shared folder not directly save in specific directory.
I also need manifest to be empty, just defaults and permission.
 

Rusty

Well-Known Member
Licensed User
Is there a way for this to preview the image? My panel is blank until I click the button. I'm using your example unchanged on an ASUS 10" tablet P00C.
All other camera, cameraEx etc. show a preview image on that device and others.
Thanks,
Rusty
 

JUAN CARLOSORDOÑEZ

Member
Licensed User
Newer example: [B4X] [B4XPages] Intent based camera

This example uses an intent to take a picture with the default camera app.

It is based on this tutorial: https://developer.android.com/training/camera/photobasics.html

It is simple to use and doesn't require any permission (*).

It does rely on the default camera app to work properly and save the image file in the path passed in the intent.
As a fallback, if the image was not saved it tries to get the thumbnail from the intent returned.

Don't miss the manifest editor code that is required for sharing file uris.

Hello, thanks in advance for the help that someone can give me
I need to translate the following lines to b4a to make an integration from one app to another through intent.


Intent i = new Intent(Intent.ACTION_SEND);


public static String PACKAGE = "rbm.pax.wimobile.com.rbmappcomercios ";
public static String SEND_COMERCIOS = "rbm.pax.wimobile.com.rbmappcomercios.features.mainmenu.ui.MainMenuActivity";
public static String packageName = "package";



ComponentName cn = new ComponentName(PACKAGE, SEND_COMERCIOS);
intent.setComponent(cn);



setResult(Activity.RESULT_OK, intent);



intent.putExtra(“data_input”, input);
 
Top