Android Development Voice Intercom, a click on the button to flash back

Source: Internet
Author: User

Is that the walkie-Talkie has a button basically the first time, click on the Flash back, the second time will be much better (if not the case, the continuous use of the basic will not flash back), but occasionally also flash back, quit the software for a while, and then when the landing is still flash back, I really do not understand, paste part of the code, ask the Great God enlighten!
Background processing: Chatbutton is the button that clicked


public void OnCreate (Bundle savedinstancestate)
{
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.chat);
Recorder = new Audiorecorder ();
int groupId = 0;
Audiomanager = (Audiomanager) this.getsystemservice (Context.audio_service);
Onlinenum = (TextView) Findviewbyid (r.id.online_num);
GroupName = (TextView) Findviewbyid (r.id.group_name);
Name= (TextView) Findviewbyid (r.id.name);
Groupphone= (TextView) Findviewbyid (R.id.leader_phone);
Phone = (TextView) Findviewbyid (R.id.phone);
Groupownername = (TextView) Findviewbyid (r.id.leader_name);
Chatbutton = (ImageView) Findviewbyid (R.id.chat_button);
Loudspeaker = (ToggleButton) Findviewbyid (R.id.loudspeaker);
Managebutton = (ImageView) Findviewbyid (R.id.manage_button);
Micoinfo = (TextView) Findviewbyid (r.id.mico_info);
Name.settext (Constant.getcurrentuser (). name);
Phone.settext (Constant.getcurrentuser (). Phone);
Chatbutton.setonclicklistener (this);
Chatbutton.setontouchlistener (New Ontouchlistener ()
{
@Override
public boolean OnTouch (View V, motionevent event)
{
Switch (event.getaction ())
{
Case MOTIONEVENT.ACTION_UP:
Stopspeaking ();
Break
Case Motionevent.action_down:
Tcpwrapper.sendcommand (constant.type_rob_mic);
Micoinfo.settext ("Rob the Wheat ...");
Break
}
return false;
}
});


SendCommand Method:
public static void SendCommand (short messageId)
{
Try
{
if (out = = null)
{
Reconnectsocket ();
}
LOG.D (TAG, "SendCommand (): messageid=" + messageId);
byte[] packet = new BYTE[3];
System.arraycopy (Utils.getbytes (MessageId), 0, packet, 0, 2);
PACKET[2] = (byte) 0;
Out.write (packet);
Out.flush ();
}
catch (IOException E)
{
LOG.E (TAG, "Write Server Data exception:" + E.getmessage ());
Turn off write stream
Try
{
if (out! = null)
{
Out.close ();
out = null;
}
}
catch (IOException IE)
{
LOG.E (TAG, "Turn off write Stream exception:" + Ie.getmessage ());
}
}
catch (NullPointerException e)
{
LOG.E (TAG, "Write Server Data exception:" + E.getmessage ());
}
}


Logcat in the wrong to quote a sentence:
07-24 14:12:40.938:A/LIBC (1661): Fatal signal 8 (SIGFPE) at 0x0000067d (code=-6), thread 1934 (Thread-9866)


The God of Understanding please help, greatly appreciated!
What else do you need to file code please leave a message!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.