You should use Instrumentation for this, which allows you to run code inside
the process of the tested application, allowing it to directly interrogate
the view hierarchy and other application state (as well as poking it however
it wants).

2009/6/16 norwind <beifen...@hotmail.com>

>
> thaks for reply.
>
> i want write a automation test tool,which just need pass some key work
> of the view into the tool, then my tool will automatically caculate
> the absolutely cordinate of the view, and click on it.
>
> for example, in phone activity, i send command "Click
> (className=android.widget.button,ViewID=numeber4)" to my tool, my tool
> will find the button,caculate the cordinate then click it.
>
> But i have problem when i try to get view info to caculate cordinate
> from the forground activity. I try to use command "DUMP
> windowhashcode" to get these info ,but as you see it consume a lot of
> time to get these info .and i found these action will make
> "android.process.acore" busy.  i can not imagine what it like if i
> dump info frequency
>
> so i wander know is there some solution to get view info of the
> forgound activity,or have some function to get cordinate of some
> view ,which just like API " FindWindow" in windows OS
>
>
>
>
>
> On 6月16日, 上午1时59分, Dianne Hackborn <hack...@android.com> wrote:
> > You should start this question with what you are actually trying to
> > accomplish, not the contortions you want to put the system through to
> > achieve whatever that is. :}
> >
> >
> >
> >
> >
> > On Mon, Jun 15, 2009 at 1:59 AM, norwind <beifen...@hotmail.com> wrote:
> >
> > > I know ,there is a method to get all view info in the forground
> > > activity,which just need connect port 4939 and send command like "DUMP
> > > 43522f60",it will output all view info included in the window
> > > (43522f60) you specified.
> > > the output stream like:
> >
> > > android.widget.imagev...@4349c790 mMeasuredWidth=2,16
> > > mMeasuredHeight=2,16 mPaddingBottom=1,0 mPaddingLeft=1,0
> > > mPaddingRight=1,0 mPaddingTop=1,0 mLeft=1,7 mID=12,id/left_icon
> > > mRight=2,23 mScrollX=1,0 mScrollY=1,0 mBottom=2,20 mTop=1,4
> > > mUserPaddingBottom=1,0 mUserPaddingRight=1,0 getBaseline()=2,-1
> > > getHeight()=2,16 layout_bottomMargin=1,0 layout_leftMargin=1,0
> > > layout_rightMargin=1,9 layout_topMargin=1,0 layout_height=2,16
> > > layout_width=2,16 getTag()=4,null getVisibility()=7,VISIBLE getWidth()
> > > =2,16 hasFocus()=5,false isClickable()=5,false isDrawingCacheEnabled()
> > > =5,false isEnabled()=4,true isFocusable()=5,false
> > > isFocusableInTouchMode()=5,false isFocused()=5,false isInTouchMode()
> > > =4,true isSelected()=5,false isSoundEffectsEnabled()=4,true
> > > willNotCacheDrawing()=5,false willNotDraw()=5,false
> >
> > > but this solution is not in-time and it need almost 3 secs to get
> > > these info. it means too long for me.
> >
> > > so my question is: Does any one konw some in-time solution to get all
> > > view info of the top avtivity. And i want know  which process handle
> > > the "DUMP" command ,in what source code i can get it
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.- 隐藏被引用文字 -
> >
> > - 显示引用的文字 -
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to