scaledrone / android-chat-tutorial Goto Github PK
View Code? Open in Web Editor NEWAndroid chat tutorial
Home Page: https://www.scaledrone.com/blog/posts/android-chat-tutorial
Android chat tutorial
Home Page: https://www.scaledrone.com/blog/posts/android-chat-tutorial
I tried to build the code that's here in the repo, but when I do it just tells me, "Could not initialize class com.android.sdklib.repository.AndroidSdkHandler" and nothing happens.
can you tell how to work in history Message ! I try but does not work
I've been following this Android tutorial and am having a strange issue. Whenever onMessage
is called, the following is printed to the console:
I/System.out: Failure: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
And the app isn't able to display messages (sending seems to work fine, however).
After some debugging I have found that clientData
of the member
object passed into MainActivity.onMessage is null.
The error seems to be happening in ObjectMapper.treeToValue
, which takes clientData as an argument.
Is this a bug with the ScaleDrone Java library, or am I doing something wrong? The code I've written while following this tutorial can be found here.
Relevant code:
public void onMessage(Room room, final JsonNode json, final Member member) {
final ObjectMapper mapper = new ObjectMapper();
Log.d(TAG, member.toString());
try {
final MemberData data = mapper.treeToValue(member.getClientData(), MemberData.class);
boolean belongsToCurrentUser = member.getId().equals(scaledrone.getClientID());
final Message message = new Message(json.asText(), data, belongsToCurrentUser);
runOnUiThread(new Runnable() {
@Override
public void run() {
messageAdapter.add(message);
messagesView.setSelection(messagesView.getCount() - 1);
}
});
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.