java - No image occure from JSON -
i have webservice returns json object decodes image
link json:
my java code in handler:
handler handler = new handler(){ @override public void handlemessage(message msg) { pd.cancel(); if (msg.obj.tostring()!= null) { jsonparse json = null; try { log.e("xxx",msg.obj.tostring()); json = new jsonparse(msg.obj.tostring()); string im = json.getchannelimage(); im = im.split("\r")[0]; if (!im.equals(null)) { byte[] decodedstring = base64coder.decode(im); log.e("byte", decodedstring.tostring()); bitmap bitmap = bitmapfactory.decodebytearray(decodedstring, 0, decodedstring.length); iv.setimagebitmap(bitmap); } else { throw new exception ("no image avaibale"); } } catch (final exception e) { // todo auto-generated catch block e.printstacktrace(); runonuithread(new runnable() { public void run() { toast toast ; toast = toast.maketext(getapplicationcontext(), "error" + e.getmessage(), 500); log.e("error",e.getmessage()); toast.show(); } }); } } else { runonuithread(new runnable() { public void run() { toast toast ; toast = toast.maketext(getapplicationcontext(), "error", 500); toast.show(); } }); } } };
layout:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical"> <textview android:layout_height="wrap_content" android:id="@+id/mainscreen" android:layout_width="fill_parent" android:text="selected channel" android:gravity="center"></textview> <imageview android:id="@+id/imageview01" android:layout_width="wrap_content" android:layout_height="wrap_content"></imageview> </linearlayout>
the problem no image shown.
log:
02-09 14:08:05.833: error/xxx(438): {"responsedata":{"image":"ivborw0kggoaaaansuheugaaasuaaadmcayaaacbw975aaaabmjlr0qa\/wd\/ap+gvaetaaaab3rj\r\ntuuh1wgcfsyeymz6dqaaiabjrefuejzt3xmgvfpi\/vfn7ehss885+wypdgmora4qhzsh+pjk6boi\r\nrhtckafuukabesgx+svx6mankjtkpgviik6+yjbgiai67bpp2fp6\/hh3z7jssm\/6rl3x+\/wppy7n\r\ney66es7aa32w9v2zdryaaiathjzetxi8u2hd395rsiyd6lqekm98pgsaaaaapjgkaqaa4hmmygaa\r\nahgeoxgaaacexyggaaca5zgkaqaa4hmmygaaahgeoxgaaacexyggaaca5zgkaqaa4hmmygaaahge\r\noxgaaacexyggaaca5zgkaqaa4hmmygaaahgeoxgaaacexyggaaca5zgkaqaa4hmmygaaahgeoxga\r\naacexyggaaca5zgkaqaa4hmmygaaahgeoxgaaacexyggaaca5zgkaqaa4hmmygaaahgeoxgaaace\r\nxyggaaca5zgkaqaa4hmmygaaahgeoxgaaacexyggaaca5zgkaqaa4hmmygaaahgeoxgaaacexygg\r\naadiez7lr0n2ot10jylekayaamgdrsodnlzjvb3b8jltvqpswhqbaaaa\/lzicaf1btfcnrsfi0uw\r\n6tofi1emaadgqj7lp4oadlcv5smu9kdm1yl4jgiaaacxavm2j\/7y6io1k+1guopnmiobaabcojrq\r\npt7nl1bxpsfl4tevrzgkg1owkh\/l5vk3as1fq5byn99vvqmq+sorzvvvsn6\/rejz\/\/\/74wnz8bjs\r\nujrzgzbixl+jzndfk7t0utllliuzdlnsmhpz3w8aamg5sz4d0pqe9w5+kuocfabrebkjoies4mif\r\n9q1w4mcucnbpjh\/r1vi121ny+3oay69br8yy5uov\/eipd+crpe9dzdeszwkgaabwrvpsvfth1ler\r\newlh01u8jvg8pfx+bq\/spuafdlcw2\/7y71stq6iowwotrluknkpsono+kv7zazkkznjlss97t6l3\r\n3lpy5vdlr9\/q4d0kxabrf5woutj0dufy0ajsrekqq5cdrzvdv6fmshxkrlihziqvyq74atp\/jm3i\r\npd9lbpgy+qtiex82xqpyrhcgxl2bx6wdm57arriuwcjewpalqjdocvxro6k+r8vxplhprpikf+tw\r\n8rdupdapj0rptjkvv6nkjnlkpv+i7nqy6xp5yrcpu6can9olsdmsml8svmr+b0q\/m1\/p+r8os2kl\r\n6vz5g99lzku98zbpcsbvsmrp\/ybhqw+l4sonvjmugx8wireqv1vlhu49saf+fetbtznpopsxckjo\r\n8mnudphhsunxpv5+tylptyn58mtsnmu4hpkszyd\/+93lb7+7nhcape2ftirnpavkrgev\/nir4yia\r\nkb+alxzq\/1zxqvxzpqar4bcyxb8j0glfhycmvtfrpsvf\/n20yruxq6hplxx16axml0svv+9bjay9\r\nxufh2g7+1q0uhjze4wfdlfmyvikp0xt\/1xtzgzeargyarhp2r9rr1wt00i4d5lny+6wrcip\/vp4t\r\nletfrx6h8icevcxtu1v09jf5oyh\/yd+2tupvvv6v815tengqwzu83yrc8ldprzirrqrq3ddvet3v\r\n8rdobrosalicjuudgx+jy\/azqe47dwqqu1j+l70ccx7ytrxptlfkwxsv7nbfdj0g4wvswcwxdvfv\r\no68rfofqrx4ohddyzauqpvnpqnz9rzxeogrtsyma4fe7l+ymoxto1kltb1yk6i5nkpdbgmu\/8dxb\r\nrzf7x6p86r8u6lin6tqoseplvhlpjap45rkv9trsdb0ukobfxwcmvnwcf1r8xkapwjuran4r8pfq\r\n2jaxanjhawotkcwlbixi86pyki5wyawxqhlo8yrqe7tpokb4w7vu5p5xkn90kvy7tzndbwxealsl\r\n0hthqwl64\/k3bgg6dga0up12ofqx7znlh+z0j26vydoehswbfatv8dkstbcqfbebrmnc8ocdvpnc\r\ntiuvok8g7qggewt2rvbfczmuouf401uaoehsgg6rir0e0gntrqs82mr0hwwdby4fn0\/hyunumf0x\r\n+vu1nn3gxqiblvw+quwppstfzjuzbomcykxkvhbnbsq7\/rypwme3aapdyf+ivi2ga8te09suvjvp\r\notgonhvfvl12vvnjd6vksuh8wbwzwqo7qflfwzto3gbykhtyh1u+6t5zpswmqwdadqludkqurx5a\r\npxy+u34ralootponrnhw0o6qfhgmggd0nv0ll1ivfypmgkfsg0djfu6lqu4edz1y5dmeka8jhzec\r\nyd+ni1vqnd3u0xm7\/v2vrxyqwig8m4pda05q+aqjsio4m3drfz8xujgj93jldzkv2hsvlt86uvyk\r\nyrokagyroc+ko3e9ujdwt1f7ionm10goff4otiyvjlxezwnu5naj7vb0+geqnzqzk3vikf8e7vx+\r\n0arz4bdpkgcwwr2rdtdl1tpvs9k53cproap7faedkrvjvouvgmq6sueivhduxcyphnugnars31ll\r\n4+7gfh0arrrdcxod3f4eddp9rkpcu5iugwzuukm4gfrkwjiogmox367nvphkfpn3ag+6cgpi0zfh\r\nkhzbuazramb\/bh0hhdlsqebupv0dkg8xxqcokmxr7pcrctdoffxsybpjqbiqk1t+6d85zg45vtl8\r\nqgw77w+6bgcoq+uh+svet+moxycq6auzrgohfn4otiyv3xkdivr1md2kopmanoysy+sw36+ye+6u\r\nvvvpugkaj6ok7ajbu4\/v2e3vueni3slpnqu3ikuv+atcp5xkuoyn+jrtsmky79didbuucn+otvv6\r\nxujtnqb41kltb1bhqsnn14ahbtwkw+eepelbg0zx8br\/m9akphy\/rbaflye3qiefoed13qzrapag\r\ns5bpcjcoyezxsnv+kuekkxgb6r1vesm1pmuguph8kr3lwslxmp95agdkgyl4u8fxtink7r2li50m\r\ncp1ykkin\/9f0drsiqpxekurty3qnaich5p8odgrunn4sl5vwgdib\/qbaxh1m10cbca89x3qfaich\r\n5p0olvnrxxts1sv0duiywmgv3ff\/zexktfdbaqjsvzecb\/mavqcam\/j6fae6dfi4jx+ss+vrlv39\r\njtkllyi98cnlfn2q7iqvzeejpqttm3\/lfir5k\/d2izfc555lugiawcmcpgtss0bazbdenzcp49ix\r\noqxefkepufou+exzzryvuxbv17\/591uripzt2sjffjcfo3ds8ocd5nu1myont13xaqoumpau0h\/8\r\n23qv5lngid3la9pe2tvrtvcbabs4vb3f4xppkr\/97qzrbjydq1ny9nnkthtkqxffk9kzlf9no1gl\r\nf3yo9iiplzgytzlkb91krcf2ueje\/vk3dpgh4j6fsm+5xjw9j9uq7xn4fz9prcf0vvybsaabaaak\r\nxf6oyn\/lfgpfcohpgr8ps3yf4upuu2lgtnmxutx93axlvh\/nonxfdy+c3fzx8zdbkjr8umly37mk\r\ngt33upicm1v\/zwttvfjg5tpptkfnx0czrzkwrpjywruv8lwwy2ravig9oiiwf2cfo+0rbyoo9vlv\r\nqsf3yxrvpct0maq9yljpggcqv\/jyfjfeci2s4mltnx4ls2kl6m8fq8smmq17hds2lzr3rllz3lwg\r\n454kd79qruce0xb52yh88talzsze7g0immuuq5ddvy99861+\/b2bnpmmpe238it69vhx2 02-09 14:08:06.033: error/byte(438): [b@43dc08a0
why split string? need image data.
string im = json.getchannelimage(); im = im.split("\r")[0];
try delete \r\n symbols json string , decode all.
string im = json.getchannelimage(); im = im.replace("\r\n", "");
Comments
Post a Comment