Android ListView with multiple String arrays using Simple Adapter

Here is a Simple and very Easy tutorial if you want to show more than two lines in a single list item.

Steps:

  1. Create 2 layouts in res/layout folder. “main.xml” and   “list_item.xml”
  2. Create a listview in main.xml                (code given below)
  3. Create two textview in list_item.xml      (code given below)
  4. Create MainActivity and set main.xml as its layout. (code given below)
  5. Run the application.

source belowSource code:

Continue reading

Android Expandable List Simple example

Android Expandable List Simple example

This is a very important view of Android and it is really complicated but here is a very simple example for the ExpandableListView.

  • Create new Android Project with package name  “com.sagar.expandablelistview.example”.
  • Create Main Activity “ExpandableListExample.java”.
  • You don’t need any layout.xml for this example.
  • Copy the code in your ExpandableListExample activity.

source belowSource code:

Continue reading