# RAD Chat Room - Part 5

DevFeed: [RAD Chat Room - Part 5](<https://devfeed.tech/articles/rad-chat-room-part-5-19490.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/rad-chatroom-part-5/>)

Author: Steve Hannah

Published: 2020-05-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Messaging](<https://devfeed.tech/topics/messaging.md>), [ui](<https://devfeed.tech/topics/ui.md>), [mvc](<https://devfeed.tech/topics/mvc.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [webcam](<https://devfeed.tech/topics/webcam.md>), [WebSocket](<https://devfeed.tech/topics/websocket.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [back-end](<https://devfeed.tech/tags/back-end.md>), [camera](<https://devfeed.tech/tags/camera.md>), [capture](<https://devfeed.tech/tags/capture.md>), [library](<https://devfeed.tech/tags/library.md>), [messaging](<https://devfeed.tech/tags/messaging.md>), [mvc](<https://devfeed.tech/tags/mvc.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

## AI overview

Part 5 of a RAD Chatroom tutorial adds a capturePhoto action that lets users select or take an image and insert it into a chat message. It also explains that the mock application has no server integration and recommends the cn1-websockets library as a starting point.

## Source excerpt

This is part 5 of the RAD Chatroom tutorial. You can find part 1 here, part 2 here, part 3 here and part 4 here. Adding A Photo Capture Feature Most messaging applications include the ability to add photos to messages. Let's add this feature to our chat app now. First we'll define a new action called "capturePhoto", and add to the TEXT_ACTIONS category of our view node. public static final ActionNode capturePhoto = action( icon(FontImage.MATERIAL_CAMERA) ); ... ViewNode viewNode = new ViewNode( actions(ChatRoomView.SEND_ACTION, send), actions(ProfileAvatarView.PROFILE_AVATAR_CLICKED_MENU, phone, videoConference), actions(ChatBubbleView.CHAT_BUBBLE_LONG_PRESS_MENU, likeAction), actions(ChatBubbleView.CHAT_BUBBLE_BADGES, likedBadge), actions(ChatRoomView.TEXT_ACTIONS, capturePhoto) __**(1)** ); __1 Added capturePhoto action to the TEXT_ACTIONS category so that it will appear as a button beside the text field. And we'll also add a handler for this action, which will capture a photo, and embed the photo in a message that we will add to the chat room's view model.