I'm having trouble using Intent to navigate screens. I want to send a variable and use it in another class.
I use a method, the method accepts a variable, but I donβt know how to send it with the intention to a new screen, which will use it to perform some actions.
The main class calls the method:
private void pantallaDetalles(final int identificador)
{
startActivityForResult(new Intent(this,MostrarDetalles.class),REQST_CODE);
}
MostrarDetalles.class is * .java that will take a variable. I start like this:
public class MostrarDetalles extends Activity {
SQLiteDatabase db;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.detalles);
Cursor c = db.rawQuery("SELECT * FROM table WHERE _id="+ identificador, null);
}
You saw? I talk about it. I do not know how to send the variable "identificador" from the main class to the second class through Intent.
Can you help me? Thank you so much for the advice.
JMasia.