android - Stackoverflow error when using comp.clickOnActionModeOverflowMenuItem(String Text) of Robotium-actionbarsherlock extension -
here test function i'm trying run
public void testdeletesingledocument () throws exception { reusable_addnew adddoc = new reusable_addnew(solo); reusable_folderanddocumentactions deldoc = new reusable_folderanddocumentactions(solo); reusable_helpfunctions = new reusable_helpfunctions(solo); adddoc.navmenuclick(); string document = "my document"; help.clearall(); adddoc.createdocument(document); adddoc.applaunch(solo); deldoc.deleteitem(document); }
and delete function
public void clickdeleteicon () throws exception { try { asserttrue( "wait text (id: com.softxpert.sds.r.id.action_delete) failed.", solo.waitfortextbyid("com.softxpert.sds.r.id.action_delete", 20000)); solo.clickontext((textview) solo .findviewbyid("com.softxpert.sds.r.id.action_delete")); } catch (assertionfailederror e){ //android.view.contextmenu. //solo.clicklongontextandpress("delete", 1); //solo.clickontext("delete"); solocompatibilityabs comp = new solocompatibilityabs(getinstrumentation()); comp.clickonactionmodeoverflowmenuitem("delete"); } catch (classcastexception x) { solo.clickonview(solo.findviewbyid("com.softxpert.sds.r.id.action_delete")); } assertdeletepopup(); }
the test fail before opening overflow menu , faliure trace ... ?!!
java.lang.stackoverflowerror
for following method ..
public void clickonactionmodeoverflowmenuitem(string text) { activity activity = solo.getcurrentactivity(); log.d("aaaa", activity.tostring()); if (!(activity instanceof sherlockfragmentactivity)) { throw new illegalstateexception("this method should called in sherlockfragmentactivity."); } actionbarcontextview actionbarcontextview = null; try { actionbarsherlock actionbarsherlock = (actionbarsherlock) invokeprivatemethodwithoutparameters( sherlockfragmentactivity.class, "getsherlock", activity); actionbarcontextview = (actionbarcontextview) getprivatefield("mactionmodeview", actionbarsherlock); } catch (exception ex) { log.d(log_tag, "can not find methods invoke action mode overflow button."); } if (actionbarcontextview == null) { assert.fail("contextual actionbar not shown."); } actionbarcontextview.showoverflowmenu(); sleeper.sleep(); clicker.clickontext(text, false, 1, true, 0); }
the actionbarcontextview come null , throw assertion fail message .. so, i'm asking
actionbarcontextview = (actionbarcontextview) getprivatefield("mactionmodeview", actionbarsherlock);
how can know private field name ?! btw. don't having access source code ...
Comments
Post a Comment