ObjectOutputStream的Activites之间

ObjectOutputStream的Activites之间

本文介绍了通过插座,ObjectInputStream的,ObjectOutputStream的Activites之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个活动在我的客户端/服务器项目:
1 - 登录(开业连接)
2 - HANDELING游戏。

I have 2 Activities in my client/server project:
1 - login (openning connection)
2 - Handeling the game.

我累了传球插座,ObjectInputStream的,ObjectOutputStream的对象提供的Intenet和startActivity但它可以只传递序列化对象。
我怎样才能通过这个对象?
我读,我可以使用该应用程序标签用于该用途的,但我不知道如何。
你们可以带我到解决方案
谢谢。

i tired passing Socket , ObjectInputStream , ObjectOutputStream objects with Intenet and startActivity but it can pass only serializable objects.
how can i pass this objects ?
i read that i can use the application tag for this use but i didn't understand how.
can you guys lead me to the solution
thanks.

推荐答案

您可以做的另一件事是存储的引用,流/插座对象的静态访问类,然后从其他活动接他们回家。

Another thing you could do is store a reference to stream/socket objects in a statically accessible class, and then pick them up from the other activity.

有关Android的静态访问强制性警告:请确保您的任何静态存储有直接或间接引用来查看或活动的对象,因为这可能会导致内存泄漏

Mandatory warning about static access in android: make sure that anything you store statically has no direct or indirect references to View or Activity objects, because this can cause memory leaks.

这篇关于通过插座,ObjectInputStream的,ObjectOutputStream的Activites之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:56