Pass a class dynamically in an Intent object

0

I'm doing ListView dynamically. When you click on any option, you connect to a database to bring the name of a class. My question is how to send that name dynamically to an object intent and address me to that class that sends the query.

    
asked by Jose Luis Torres Hernández 13.07.2018 в 02:38
source

1 answer

0

As Alex has told you, you can send data in an Intent with the putExtra method, for example:

Intent intent = new Intent(this, NuevoActivity.class);
intent.putExtra("title", title);
intent.putExtra("message", message);
startActivity(intent);

In this example in the intent to change to NewActivity you send two extras called title and message in which you send the title and message varibals, and then you could receive it and save it in variables like this:

tituloRecibido = getIntent().getStringExtra("title");
mensajeRecibido = getIntent().getStringExtra("message");

In this case both extras that are sent are Strings.

    
answered by 13.07.2018 / 17:21
source