Launch Camera from Sketchware App and get image to ImageView

Sketchware introduced Camera component in it's new update, version 3.0.0.

Camera component in Sketchware can be used to launch camera from a Sketchware App and get the captured image to ImageView. To learn how, follow the steps given below.

1. In VIEW area of your sketchware project add an ImageView imageview1 and a Button button1.

Set layout_width and layout_height of ImageView to 300, and choose scale_type of ImageView as FIT_CENTER.

2. In LOGIC area of your sketchware project, add a new Camera component cam.

3. In onButtonClick event use the block
Camera cam take picture.
This will launch the camera to take a picture.

4. Add a new event Camera onPictureTaken. Here use the block
ImageView imageview1 set image from file path filePath.

This will display the captured image in ImageView.

5. Save and run the project. Now if you click the Button, it will open camera, and the captured image will be displayed in ImageView.

Watch this video for more details:


To get code for creating imageview with rounded corners visit here: http://www.sketchwarehelp.com/2017/11/create-imageview-with-rounded-corners.html

Comments

  1. Replies
    1. You can set a PNG image as image initially. Check this, it may help you: https://youtu.be/0uIEaJ99Dw8

      Delete
  2. The link wpnt work i need to set a image to linear mabe with replace image "(image)" whith bitmap photo

    PS i CANT code
    PS douwnload my app TextRemaker+

    ReplyDelete
  3. How can I send it to a Firebase DB?

    ReplyDelete
  4. how can i use it .. with another code of open gallery and get image ...its make (duplicate error with ((int.int.int.intent)))
    on onother open gallery code 😢

    ReplyDelete
  5. [/storage/emulated/0/.sketchware/libs/com.android.support/support-media-compat/27.0.2/res/layout/notification_template_big_media.xml:23: error: Error: No resource found that matches the given name (at 'layout' with value '@layout/notification_template_icon_group')., , /storage/emulated/0/.sketchware/libs/com.android.support/support-media-compat/27.0.2/res/layout/notification_template_big_media_custom.xml:23: error: Error: No resource found that matches the given name (at 'layout' with value '@layout/notification_template_icon_group')., , /storage/emulated/0/.sketchware/libs/com.android.support/support-media-compat/27.0.2/res/layout/notification_template_media.xml:24: error: Error: No resource found that matches the given name (at 'layout' with value '@layout/notification_template_icon_group')., , /storage/emulated/0/.sketchware/libs/com.android.support/support-media-compat/27.0.2/res/layout/notification_template_media_custom.xml:24: error: Error: No resource found that matches the given name (at 'layout' with value '@layout/notification_template_icon_group')., ]


    why error in sketchware 3.9.9

    ReplyDelete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

Simple car racing android game in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity