I got the confusion while trying to simulate users to touch ListView as below:
ListView mList = (ListView)getActivity().findViewById(android.R.id.list);
Log.i("Music", "mList isFocused: " + mList.isFocused());
Log.i("Music", "getChildAt(-1): " + mList.getChildAt(-1));
Log.i("Music", "getChildAt(0): " + mList.getChildAt(0));
Log.i("Music", "getChildAt(1): " + mList.getChildAt(1));
Log.i("Music", "getChildAt(2): " + mList.getChildAt(2));
Log.i("Music", "mList_ChildCount: "+ mList.getChildCount() );
TouchUtils.clickView(this, mList.getChildAt(0));
Output:
mList isFocused: true
getChildAt(-1): null
getChildAt(0): android.widget.RelativeLayout@46bfe620
getChildAt(1): android.widget.RelativeLayout@46c01a08
getChildAt(2): null
mList_ChildCount: 2
and this is to click on the list of index 0 as expected.
What Im confused about is that it is to touch the view of index 0
although I change code to:
TouchUtils.clickView(this, mList.getChildAt(1)); WHY?
While declaring mList.getChildAt(), only index 0 is shown on hint for possible value. index 1 is gone?!!
Anyone has any idea
Thanks a lot!
ListView mList = (ListView)getActivity().findViewById(android.R.id.list);
Log.i("Music", "mList isFocused: " + mList.isFocused());
Log.i("Music", "getChildAt(-1): " + mList.getChildAt(-1));
Log.i("Music", "getChildAt(0): " + mList.getChildAt(0));
Log.i("Music", "getChildAt(1): " + mList.getChildAt(1));
Log.i("Music", "getChildAt(2): " + mList.getChildAt(2));
Log.i("Music", "mList_ChildCount: "+ mList.getChildCount() );
TouchUtils.clickView(this, mList.getChildAt(0));
Output:
mList isFocused: true
getChildAt(-1): null
getChildAt(0): android.widget.RelativeLayout@46bfe620
getChildAt(1): android.widget.RelativeLayout@46c01a08
getChildAt(2): null
mList_ChildCount: 2
and this is to click on the list of index 0 as expected.
What Im confused about is that it is to touch the view of index 0
although I change code to:
TouchUtils.clickView(this, mList.getChildAt(1)); WHY?
While declaring mList.getChildAt(), only index 0 is shown on hint for possible value. index 1 is gone?!!
Anyone has any idea
Thanks a lot!