android - sending and receiving emoticons to webservice -
i have implemented https://github.com/ankushsachdeva/emojicon lib emoticons , emoticons displayed in edit text. have edit text takes in both text , emoticons. want text/emoticons entered in edit text sent web service. when text edit text can see '??' of emoticons on server.i know got convert emoticon unicode , send don't know how implement , how decode emoticons in edit text. please me.
i text edit text , save in 'userstatus' string , pass json as
list<namevaluepair> params = new arraylist<namevaluepair>(); log.d("userstatus",userstatus); params.add(new basicnamevaluepair("my_status",userstatus)); params.add(new basicnamevaluepair("user_id",userid)); try{ // getting json string url jsonobject json3 = jparser.makehttprequest(url_updateprofilestatus, "post", params);
my json class
public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } // function json url // making http post or mehtod public jsonobject makehttprequest(string url, string method, list<namevaluepair> params) { // making http request try { // check request method if(method == "post"){ // request method post // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httppost.setentity(new urlencodedformentity(params)); httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); = httpentity.getcontent(); }else if(method == "get"){ // request method defaulthttpclient httpclient = new defaulthttpclient(); string paramstring = urlencodedutils.format(params, "utf-8"); url += "?" + paramstring; httpget httpget = new httpget(url); httpresponse httpresponse = httpclient.execute(httpget); httpentity httpentity = httpresponse.getentity(); = httpentity.getcontent(); } } catch (unsupportedencodingexception e) { e.printstacktrace(); } catch (clientprotocolexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } try { bufferedreader reader = new bufferedreader(new inputstreamreader( is, "iso-8859-1"), 8); stringbuilder sb = new stringbuilder(); string line = null; while ((line = reader.readline()) != null) { sb.append(line + "\n"); } is.close(); json = sb.tostring(); } catch (exception e) { log.e("buffer error", "error converting result " + e.tostring()); } // try parse string json object try { jobj = new jsonobject(json); } catch (jsonexception e) { log.e("json parser", "error parsing data " + e.tostring()); } // return json string return jobj; }
}
emoticons nothing special sequence of text refer emoticons on device. while sending emoticons don't send emoticons sequence of text character associated it. once device receives it, replaces particular text right emoticons (image). (^) equivalent cake emoticons in skype.
Comments
Post a Comment