Skip to content

Commit 446ddfd

Browse files
committed
Added images for "send a message"
1 parent 9a6ebc9 commit 446ddfd

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

codelabs/chat/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ Before we can start writing code that interacts with our Firebase database, we'l
105105

106106
![gradle.build with Firebase additions](images/3_1.png)
107107

108-
4. At this stage you'll need to synchronize the project with the gradle files again, so Tools > Android > Sync Project with Gradle Files. Android Studio will parse the gradle files and pick up our changes. You can also click the dedicated button in the toolbar
108+
4. At this stage you'll need to synchronize the project with the gradle files again. Either click the Sync Now link in the notification bar or the corresponding button in the toolbar: Sync Project with Gradle Files.
109109

110-
![Sync now button in toolbar](images/3_2.png)
110+
![Sync Project with Gradle Files button in toolbar](images/3_2.png)
111+
112+
Android Studio will parse the gradle files and pick up our changes.
111113

112114
5. Since Firebase is a hosted service, our app will need to be able to access the internet.
113115
6. Open app > manifests > AndroidManifest.xml
@@ -144,9 +146,9 @@ That's all the setup that is required. Next up we'll allow the user to enter a m
144146

145147
## Send a message
146148

147-
Now we can start sending data to Firebase! In this step we'll allow the user to enter a message in a text box. When they then click the Send button, we will send the message to Firebase.
149+
Next we'll send data to Firebase! In this step we'll allow the user to enter a message in a text box. When they then click the Send button, we will send the message to Firebase.
148150

149-
[screenshot:forge+send message]
151+
![Data dashboard and app for sending a message](images/4_1.png)
150152

151153
1. We'll first add the necessary views to activity_main.xml:
152154

@@ -170,16 +172,16 @@ Now we can start sending data to Firebase! In this step we'll allow the user to
170172
android:text="Send" />
171173
</LinearLayout>
172174

173-
This layout gives us an `EditText`, where the user can enter their chat message, and a `Button` that they can click to send the message.
175+
This layout puts a horizontal bar at the bottom that contains an `EditText`, where the user can enter their chat message, and a `Button` that they can click to send the message.
174176

175-
[screenshot:activity_main.xml with footer]
177+
![Activity_main.xml with footer](images/4_2.png)
176178

177179
2. In our `MainActivity.java` we'll now add variables for the `EditText` and `Button` at the end of the onCreate method:
178180

179181
final EditText textEdit = (EditText) this.findViewById(R.id.text_edit);
180182
Button sendButton = (Button) this.findViewById(R.id.send_button);
181183

182-
[screenshot:main activity Java with EditText and Button bound]
184+
![MainActivity.java with EditText and Button bound](images/4_3.png)
183185

184186
3. Next, we'll add a method that grabs the text from the input and send it to our Firebase database:
185187

@@ -197,11 +199,11 @@ Now we can start sending data to Firebase! In this step we'll allow the user to
197199

198200
You will have to import the packages for some of these classes. Android Studio will tell you where to import them from.
199201

200-
4. Here we grab the message from the EditText, add it to a Map, and send it off to Firebase. We'll look at a way to replace that Map with something more type-safe in the next section, but for now this will work.
202+
Here we grab the message from the EditText, add it to a Map, and send it off to Firebase. We'll look at a way to replace that Map with something more type-safe in the next section, but for now this will work.
201203

202204
We hard-coded our user name for the moment. We'll use Firebase Authentication to make this dynamic in the last section of this code lab.
203205

204-
[screenshot with completed onCreate]
206+
![onCreate with sendButton implemented](images/4_4.png)
205207

206208
5. If you now run the application in the emulator, you will see an input field with a Send button that sends the message to Firebase. Open the URL of your Firebase database, and you'll see it light up green as you add new messages.
207209
6. Open the Data tab in the Firebase Dashboard of your app. You'll see it light up green as you add new messages. Admit it, this is pretty cool!

codelabs/chat/images/4_1.png

139 KB
Loading

codelabs/chat/images/4_2.png

241 KB
Loading

codelabs/chat/images/4_3.png

206 KB
Loading

codelabs/chat/images/4_4.png

244 KB
Loading

0 commit comments

Comments
 (0)