-
Notifications
You must be signed in to change notification settings - Fork 16
Part 1: Building the Android client
Sergi Almar edited this page Nov 20, 2013
·
10 revisions
The Android Chat client should be able to send and receive messages from a chat room.
- Start Android Studio and create a new project called
MobosChatwith the base packagecom.mobos.android - Create a blank activity called
ChatActivity
The fragment will contain the layout for our chat application. Open the fragment_chat.xml (or the name you've given to out fragment layout) and define:
- A
ViewListthat will contain the chat messages - An
EditTextto write the message we want to send to the chat room - A
Buttonto send the message
Run the app and see you get the desired layout
In order to use RoboGuice for the dependency injection, we need to add it as a project dependency. Open the gradle.build file and add the RoboGuice dependency under the dependencies element
compile 'org.roboguice:roboguice:3.0b-experimental'
Make sure RoboGuice appears in your External Libraries
Our Android components will need to extend RoboGuice specific classes to have DI in place.
- Edit your
Fragmentand extend fromRoboFragment - Edit you
Activityand extend fromRoboFragmentActivity