Java 如何通过蓝牙发送日历类的变量

Java 如何通过蓝牙发送日历类的变量,java,android,bluetooth,android-bluetooth,Java,Android,Bluetooth,Android Bluetooth,calendar类的变量不是字符串。 我想知道如何传递时间变量值​​通过蓝牙连接至电路板。 pickerTime是Activity_main.xml中的时间选择器 ,按钮Stalarm是设置报警的按钮 这是来源: pickerTime.setCurrentMinute(now.get(Calendar.MINUTE)); ///------------------------ALARM buttonSetAlarm = (Button)findVi

calendar类的变量不是字符串。 我想知道如何传递时间变量值​​通过蓝牙连接至电路板。 pickerTime是Activity_main.xml中的时间选择器 ,按钮Stalarm是设置报警的按钮

这是来源:

        pickerTime.setCurrentMinute(now.get(Calendar.MINUTE));
        ///------------------------ALARM
        buttonSetAlarm = (Button)findViewById(R.id.setalarm);
        buttonSetAlarm.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View arg0) {
                Calendar current = Calendar.getInstance();

                Calendar cal = Calendar.getInstance();
                cal.set(pickerDate.getYear(),
                        pickerDate.getMonth(),
                        pickerDate.getDayOfMonth(),
                        pickerTime.getCurrentHour(),
                        pickerTime.getCurrentMinute(),00);

                if(cal.compareTo(current) <= 0){
                    //The set Date/Time already passed
                    Toast.makeText(getApplicationContext(),
                            "Invalid Date/Time",
                            Toast.LENGTH_LONG).show();
                }else{
                    setAlarm(cal);

                }

            }}); 
请帮帮我,因为我不知道如何传递时间值。
谢谢。

您想发送哪种类型的数据?我想发送整数。可以发送吗?您可以看到您发送的是
字节[]
,而不是
字符串。只需将整数转换为
字节[]
,然后发送。或者将其转换为
字符串
,然后发送。这取决于收件人的期望。我感谢您的帮助。我想知道cal是什么类型的?我不确定是否要发送变量值。我无法转换变量。它不能应用于(java.util.Calendar)
public void setSendData(String sendData) {
            byte[] magBuffer = sendData.getBytes();
            try {
                mmOutStream.write(magBuffer);

            } catch (IOException e) {

            }
        }