Coder Social home page Coder Social logo

edittext_listview's Introduction

EditText_ListView

Sample ListView of EditTexts, using custom ArrayAdapter. Responds appropriately to user input.

Goal:

Want to have a ListView of dynamically generated EditTexts for a user to modify (for example, so a user can enter possible responses when creating a poll, a list of friends to send a message to, etc.)

Problem:

The standard ArrayAdapter which provides the bridge between a list of data and the list of views defaults to a list of TextViews, and assumes you want your view to update based on your data. But if we want to handle a list of user input, we need our ListView to contain EditTexts, and we want our list of data to update based on what the user inputs in the view (exactly the reverse of the default ArrayAdapter!)

Solution

Extend the ArrayAdapter class (see MyArrayAdapter) and override the getView() method to return an EditText. Use a TextWatcher to update the list of data when any text is changed by the user.

Quite simple!

edittext_listview's People

Contributors

bkestelman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.