java - Drag and Drop switch case, unreachable code? -
why code unreachable , how fix it?
public void draggingevent() { image15(); final int thisletter = currentletter; mimageview15.getdrawable(); mimageview15 = (imageview) findviewbyid(r.id.imageview15); mimageview15.setondraglistener(new ondraglistener() { public boolean ondrag(view v, dragevent de) { // todo auto-generated method stub final int action = de.getaction(); switch(action) { case dragevent.action_drag_started: if (de.getclipdescription().hasmimetype(clipdescription.mimetype_text_plain)) { v.invalidate(); return (true); } break; case dragevent.action_drag_entered: v.invalidate(); return (true); break; //un reachable here case dragevent.action_drag_location: //ignore if (de.getx() == 250 && de.gety() == 195) { mimageview17.setimageresource(thisletter); v.invalidate(); return (true); } if (de.getx() == 300 && de.gety() == 195) { mimageview17.setimageresource(thisletter); return (true); } break;// here case dragevent.action_drag_exited: de.getresult(); break; //here case dragevent.action_drop: clipdata.item item = de.getclipdata().getitemat(thisletter); v.invalidate(); return (true); break; // here case dragevent.action_drag_ended: v.invalidate(); if (de.getresult()) { log.e("it worked", "worked"); } else { log.e("failed", "sorry failed drag , drop"); return (true); } break; //here default: log.e("drag drop", "failed find area"); break; // , here }; return false; }; });
you cannot execute java
statement after return:
return (true); break; //un reachable here
just have return
statement. (you have 2 such occurrences)
Comments
Post a Comment