1. Android Central Question's Avatar
    hello . i created a listView with 40 items.
    and i created 40 activity for that 40items.
    but when i select every item ,just one activity starts.
    how can i use special activity for special item.

    thanks.
    02-05-2018 11:11 AM
  2. B. Diddy's Avatar
    I moved this to the Software Development forum for more specific traffic.
    02-05-2018 12:36 PM
  3. Taritz's Avatar
    It doesn't make sense when you say you have 40 activities for the 40 items in the listview. An Activity represents a single screen with a user interface, that covers the entire screen.

    What you need to do is add a click listener to every item in the listview and handle the click in whatever way you like. If you expect to open a different Activity for every item, the easiest way would probably be to delegate the click event to the parent activity that holds the listview and have that handle the click events for the entire list, have a switch statement (or when if you're using Kotlin) and open the correct Activity for every separate item when clicked.

    If you indeed have 40 different activities a better approach might be to just have the one activity and then just add fragments to it instead though.
    02-12-2018 02:22 PM

Similar Threads

  1. How do I delete photos that have been deleted
    By Android Central Question in forum Ask a Question
    Replies: 3
    Last Post: 02-06-2018, 01:54 PM
  2. How are updates?
    By dlalonde in forum Moto Z
    Replies: 5
    Last Post: 02-05-2018, 09:45 PM
  3. How to calibrate accelerometer on Galaxy S8?
    By Android Central Question in forum Ask a Question
    Replies: 0
    Last Post: 02-05-2018, 10:32 AM
LINK TO POST COPIED TO CLIPBOARD