⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chatmain.java

📁 基于手机蓝牙的即时通讯平台
💻 JAVA
字号:
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.LocalDevice;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class ChatMain extends MIDlet {

	protected void startApp() throws MIDletStateChangeException {
		MainUI ui = new MainUI(this);
		DeviceConnection protocol = new DeviceConnection(ui);

		try {	//获得设备用户名
			protocol.setUserName(LocalDevice.getLocalDevice().getFriendlyName());
		} catch (BluetoothStateException e) {
			protocol.setUserName("用户");
		}

		new Server(protocol).start();		//开启服务器线程
		new Discovery(protocol).start();	//开启设备搜索线程

		ui.setCurrent();
	}

	protected void pauseApp() {
	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		Log.clear();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -