java - Unreachable code? user image upload -
eclipse keeps showing me syntax error insert '}' complete classbody @ dne of code, when so, shows different error last part of code unreachable? doing wrong?
my code:
public class getimage extends activity { private static final int myimage =1; imageview iv; @override protected void oncreate(bundle savedinsatncestate){ super.oncreate(savedinsatncestate); setcontentview(r.layout.diary_edit); iv=(imageview)findviewbyid(r.id.imageview1); } public void btnclick(view v){ intent int3 = new intent(intent.action_pick,android.provider.mediastore.images.media.external_content_uri); startactivityforresult(int3,myimage); } @override protected void onactivityresult (int requestcode , int resultcode , intent data){ super.onactivityresult(requestcode , resultcode , data); switch (requestcode){ case myimage : if(resultcode == result_ok){ uri uri=data.getdata(); string[]projection ={mediastore.images.media.data}; cursor cursor = getcontentresolver ().query(uri,projection , null,null,null); cursor.movetofirst(); int columnindex=cursor.getcolumnindex(projection[0]); string filepath=cursor.getstring(columnindex); cursor.close(); bitmap yourselectedimage=bitmapfactory.decodefile(filepath); drawable d=new bitmapdrawable(yourselectedimage); iv.setbackground(d); } break; ault: break; } }
you're missing } @ end of class , ault should default :)
Comments
Post a Comment