Search code examples
androidcodebaselocate

How to find the code related to a small UI component quickly in a large Android codebase?


I just started my work as an Android developer. My first assignment is to fix several bugs of an App call DailyFinance.

One bug is UI related, if you click a button on a certain page, a dialog will pop up, but the dialog is not displayed properly. My question is how can I locate the code (xml layout file as well as activities) related to the dialog quickly in the codebase which I am not familiar with?


Solution

  • Couple approaches come in mind:

    1. Search for any text that displayed on the target dialog.
    2. Search button text and locate the xml layout file that that contains the button which launch the target dialog
    3. Once find the xml layout file, determine the button 'id' as xxxxx, then you can further search for source contains references to 'R.id.xxxxx'