开发者

Send Android View from server to client

I want to send a (Text)View element from a server application (='normal', non-Android Java) to the Android app on the phone and display it there. Creating it like this on the Server...

TextView tv=new TextView(Client.myClient);

... gives me this error:

Exception in thread "main" java.lang.RuntimeException: Stub!

myClient is defined like this in Client:

public static Client myClient;.

In onCreate() on the Client I wrote myClie开发者_JS百科nt=this;.

(Server has access to all Client classes, so that's not the problem.)

What am I doing wrong? Can I maybe create the TextView with another Context than the Client's, send it, and then display it on the client? (Later I want to send arbitrary Views, that's why I don't only send the String of the TextView.) Thanks a lot in advance!


Not sure you can do this: as far as I can tell Context is not Serializable or otherwise transferrable. You might be able to come up with a usable description language (maybe transfer the complete XML and reparse it on the client?) but not sure you can do what you've described above out of the box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜