First, Test Target Activity...
Reference Basic GirdView Program to here.
Add OnItemClickListener() include GridView. It is selected position information.
OnItemClickListener Class.
mGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView arg0, View arg1, int position, long id) { Log.d("GridViewActivity", "onItemClick " + position + " " + id); } });Second, Tester. It is extends ActivityInstrumentationTestCase2. I call performItemClick with GridView and postion. must be UIThread
mActivity.runOnUiThread(new Runnable() { public void run() { Log.d("GridViewActivity", "performItemClick 3"); gridview.performItemClick(gridview, 3, 0); } }); mInstrumentation.waitForIdleSync();Check Logcat.
performItemClick 3 onItemClick 3 0It is OK.
Test target source code is here.
Tester source code is here.
0 件のコメント:
コメントを投稿