Android Browser Research (vi)---ADT debugging activity initiated via intent

Source: Internet
Author: User

encounter a problem today, in the music app Long press A song, select Search in the pop-up menu, select the browser in the Search selection box. Normally you should open the browser and start the search using the default search engine, but now the browser search interface is not open. The first thought is to open the browser project, set breakpoints in the relevant location, start debugging, found that everything is working properly, the browser interface opens and normally starts the search process. The original problem only occurs when the browser process has not started, and the music app uses Intent to launch the browser to search for the case. Here's how to start debugging analysis in this case.

first, the application is used by other applications Intent started, and we need to debug it. when debugging the program in C/s + +, we typically debug the debugger as attach to a given process number, in fact ADT supports this scenario: Open browser APK Project, open ddmsperspective, if the current browser is already running, in the Devices view click your app, this time Devices view of the green Bug button will become Active State, click on it to Attach to the process for debugging,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/28/3F/wKioL1N2wFHgHzhSAAHenyIkFUc642.jpg "title=" Browser. png "alt=" wkiol1n2wfhghzhsaahenyikfuc642.jpg "/>

second, your app may end soon after it's started, and you haven't had time to Attach to it ( your breakpoint does not work before Attach to it). You need your application to wait for you, so that you can attach it in time . The easiest way to do this is to Sleep before your breakpoint , or use a different synchronization scheme (in traditional applications we usually read a keyboard input to synchronize).


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.