Search code examples
androidandroid-source

Android EditContactActivity source


Android EditContactActivity contains the functionality when + button is pressed new field is added to listview and - button delete that extra field. I need this exact functionality, but I could not find it in Android source code.
How to extract this particular functionality? And if someone can tell me how to understand android source code.


Solution

  • If i remember correctly it's not a ListView at all actually, more like:

    <LinearLayout>
        <ScrollView>
            <LinearLayout>
                All the editors go here
            </LinearLayout>
        </ScrollView>
        <LinearLayout>
                Buttons and stuff goes here
        </LinearLayout>
    </LinearLayout>
    

    Basically they're adding and removing items in a LinearLayout at the right position.

    If you want to look into the specifics a (complete?) mirror of the Android repo is up at github - the contacts app, for instance, is here: https://github.com/android/platform_packages_apps_contacts