This Android Studio project demonstrates the implementation of a simple ListView with clickable items. The app displays a list of cities, and when a city is clicked, a toast message is shown to indicate the selected city.
-
Clone the Repository:
git clone https://github.com/atiquz/AndroidStudioListView
-
Open in Android Studio:
- Launch Android Studio.
- Choose "Open an existing Android Studio project."
- Navigate to the cloned project and select the
AndroidStudioListView
directory.
-
Run the App:
- Connect an Android device or use an emulator.
- Click on the "Run" button in Android Studio.
The project structure is organized as follows:
app
Module:-
src/main/java/com/atidevelopers/androidstudiolistview/MainActivity.java
: Contains the main activity code, including the ListView setup and item click handling. -
src/main/res/layout/activity_main.xml
: Defines the layout of the main activity, including the ListView widget. -
src/main/res/values/strings.xml
: Contains string resources, including the array of city names.
-
- The project does not have any additional dependencies beyond the default Android dependencies.
-
The
MainActivity
class initializes the ListView and populates it with an array of city names using anArrayAdapter
. -
The
setOnItemClickListener
method is used to listen for item clicks on the ListView. -
When a city is clicked, a toast message is displayed, indicating the selected city.
Include screenshots of the app in action (optional).
Feel free to contribute to the project by opening issues or submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- This project was created as a learning example for Android ListView implementation.
- Acknowledge any third-party libraries or resources used (if any).
For any inquiries or feedback, please contact the project maintainer:
- Md Atiquz Zaman
- [email protected]
- https://github.com/atiquz
Thank you for checking out this Android Studio ListView example!