0

I am making a ListView. I want to use a unique Intent object and pass it a class on dynamic form. For example, I have a lot of class names saved in a database table. I make a query to get a name and use it as parameter on an Intent objet (Intent intent = new Intent (this, variable)). How can I do this on dynamic form?

Ashutosh Sagar
  • 981
  • 8
  • 20
  • 2
    Possible duplicate of [How to pass an object from one activity to another on Android](https://stackoverflow.com/questions/2736389/how-to-pass-an-object-from-one-activity-to-another-on-android) – GianhTran Jul 13 '18 at 00:58

1 Answers1

0

It sounds like you're needing to create an intent for an activity based on its class name. Use Class.forName to get a class by name.

 try {
    Class<?> yourClass= Class.forName("yourClassName");
    Intent intent = Intent(context,yourClass)

 } catch (ClassNotFoundException e) {
        e.printStackTrace();
}

This would work I believe

Jonas
  • 51
  • 4