How to pass an int data with an intent?
up vote
-1
down vote
favorite
Hi I'm doing a project and I'm using room persistence to manage my database but when I get the id from my activity to pass it to another activity for edit the data it gives that incompatible types
Here is my DaoClass, I want to call getOne methos
@Insert
void insert(Entradas entradas);
@Update
void update(Entradas entradas);
@Delete
void delete(Entradas entradas);
@Query("DELETE FROM Entradas")
void deleteAll();
@Query("SELECT * FROM Entradas")
LiveData<List<Entradas>> getAll();
@Query("SELECT * FROM Entradas WHERE IdEntrada ==:Id")
LiveData<Entradas> getOne(int Id);
Here is my activity, when I'm using the methos longClickListener to sent me to another activity
adapter.addActionCallback(new EntradasAdapter.ActionCallback() {
@Override
public void onLongClickListener(Entradas entradas) {
Intent intent = new Intent(getActivity(), UpdateEntradaActivity.class);
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
startActivity(intent);
}
});
And this the activity that I want to show the data
public static String EXTRA_ENTRADA_ID = "IdEntrada";
private Button btnCalendario, btnCrear;
private EditText etNombre, etSaldo;
private TextView etFecha;
Calendar c;
DatePickerDialog dpd;
private CategoriaEntradasViewModel viewModel;
private CuentasViewModel viewModel1;
private EntradasViewModel viewModel2;
Spinner spinner, spinner1;
List<CategoriaEntradas> categoriaEntradas1;
List<Cuentas> cuentas1;
private EntradasDao mEntradasDAO;
private Entradas ENTRADAS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_entrada);
getSupportActionBar().setTitle(Html.fromHtml("<font color='#FFFFFF'>"+"Editar Entrada"+"</font>"));
getSupportActionBar().setElevation(0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
mEntradasDAO = Room.databaseBuilder(this, Database.class, "Database")
.allowMainThreadQueries() //Allows room to do operation on main thread
.build()
.entradasDao();
final Context ctx = this;
etNombre= findViewById(R.id.editText);
etSaldo= findViewById(R.id.editText4);
etFecha = (TextView) findViewById(R.id.txtFecha);
btnCalendario= (Button) findViewById(R.id.btnFecha);
btnCrear = findViewById(R.id.btnCrear);
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
}
The error is in the last line ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
it says getOne(int) in EntradasDao cannot be applied to java.lang.String
add a comment |
up vote
-1
down vote
favorite
Hi I'm doing a project and I'm using room persistence to manage my database but when I get the id from my activity to pass it to another activity for edit the data it gives that incompatible types
Here is my DaoClass, I want to call getOne methos
@Insert
void insert(Entradas entradas);
@Update
void update(Entradas entradas);
@Delete
void delete(Entradas entradas);
@Query("DELETE FROM Entradas")
void deleteAll();
@Query("SELECT * FROM Entradas")
LiveData<List<Entradas>> getAll();
@Query("SELECT * FROM Entradas WHERE IdEntrada ==:Id")
LiveData<Entradas> getOne(int Id);
Here is my activity, when I'm using the methos longClickListener to sent me to another activity
adapter.addActionCallback(new EntradasAdapter.ActionCallback() {
@Override
public void onLongClickListener(Entradas entradas) {
Intent intent = new Intent(getActivity(), UpdateEntradaActivity.class);
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
startActivity(intent);
}
});
And this the activity that I want to show the data
public static String EXTRA_ENTRADA_ID = "IdEntrada";
private Button btnCalendario, btnCrear;
private EditText etNombre, etSaldo;
private TextView etFecha;
Calendar c;
DatePickerDialog dpd;
private CategoriaEntradasViewModel viewModel;
private CuentasViewModel viewModel1;
private EntradasViewModel viewModel2;
Spinner spinner, spinner1;
List<CategoriaEntradas> categoriaEntradas1;
List<Cuentas> cuentas1;
private EntradasDao mEntradasDAO;
private Entradas ENTRADAS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_entrada);
getSupportActionBar().setTitle(Html.fromHtml("<font color='#FFFFFF'>"+"Editar Entrada"+"</font>"));
getSupportActionBar().setElevation(0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
mEntradasDAO = Room.databaseBuilder(this, Database.class, "Database")
.allowMainThreadQueries() //Allows room to do operation on main thread
.build()
.entradasDao();
final Context ctx = this;
etNombre= findViewById(R.id.editText);
etSaldo= findViewById(R.id.editText4);
etFecha = (TextView) findViewById(R.id.txtFecha);
btnCalendario= (Button) findViewById(R.id.btnFecha);
btnCrear = findViewById(R.id.btnCrear);
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
}
The error is in the last line ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
it says getOne(int) in EntradasDao cannot be applied to java.lang.String
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
Hi I'm doing a project and I'm using room persistence to manage my database but when I get the id from my activity to pass it to another activity for edit the data it gives that incompatible types
Here is my DaoClass, I want to call getOne methos
@Insert
void insert(Entradas entradas);
@Update
void update(Entradas entradas);
@Delete
void delete(Entradas entradas);
@Query("DELETE FROM Entradas")
void deleteAll();
@Query("SELECT * FROM Entradas")
LiveData<List<Entradas>> getAll();
@Query("SELECT * FROM Entradas WHERE IdEntrada ==:Id")
LiveData<Entradas> getOne(int Id);
Here is my activity, when I'm using the methos longClickListener to sent me to another activity
adapter.addActionCallback(new EntradasAdapter.ActionCallback() {
@Override
public void onLongClickListener(Entradas entradas) {
Intent intent = new Intent(getActivity(), UpdateEntradaActivity.class);
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
startActivity(intent);
}
});
And this the activity that I want to show the data
public static String EXTRA_ENTRADA_ID = "IdEntrada";
private Button btnCalendario, btnCrear;
private EditText etNombre, etSaldo;
private TextView etFecha;
Calendar c;
DatePickerDialog dpd;
private CategoriaEntradasViewModel viewModel;
private CuentasViewModel viewModel1;
private EntradasViewModel viewModel2;
Spinner spinner, spinner1;
List<CategoriaEntradas> categoriaEntradas1;
List<Cuentas> cuentas1;
private EntradasDao mEntradasDAO;
private Entradas ENTRADAS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_entrada);
getSupportActionBar().setTitle(Html.fromHtml("<font color='#FFFFFF'>"+"Editar Entrada"+"</font>"));
getSupportActionBar().setElevation(0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
mEntradasDAO = Room.databaseBuilder(this, Database.class, "Database")
.allowMainThreadQueries() //Allows room to do operation on main thread
.build()
.entradasDao();
final Context ctx = this;
etNombre= findViewById(R.id.editText);
etSaldo= findViewById(R.id.editText4);
etFecha = (TextView) findViewById(R.id.txtFecha);
btnCalendario= (Button) findViewById(R.id.btnFecha);
btnCrear = findViewById(R.id.btnCrear);
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
}
The error is in the last line ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
it says getOne(int) in EntradasDao cannot be applied to java.lang.String
Hi I'm doing a project and I'm using room persistence to manage my database but when I get the id from my activity to pass it to another activity for edit the data it gives that incompatible types
Here is my DaoClass, I want to call getOne methos
@Insert
void insert(Entradas entradas);
@Update
void update(Entradas entradas);
@Delete
void delete(Entradas entradas);
@Query("DELETE FROM Entradas")
void deleteAll();
@Query("SELECT * FROM Entradas")
LiveData<List<Entradas>> getAll();
@Query("SELECT * FROM Entradas WHERE IdEntrada ==:Id")
LiveData<Entradas> getOne(int Id);
Here is my activity, when I'm using the methos longClickListener to sent me to another activity
adapter.addActionCallback(new EntradasAdapter.ActionCallback() {
@Override
public void onLongClickListener(Entradas entradas) {
Intent intent = new Intent(getActivity(), UpdateEntradaActivity.class);
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
startActivity(intent);
}
});
And this the activity that I want to show the data
public static String EXTRA_ENTRADA_ID = "IdEntrada";
private Button btnCalendario, btnCrear;
private EditText etNombre, etSaldo;
private TextView etFecha;
Calendar c;
DatePickerDialog dpd;
private CategoriaEntradasViewModel viewModel;
private CuentasViewModel viewModel1;
private EntradasViewModel viewModel2;
Spinner spinner, spinner1;
List<CategoriaEntradas> categoriaEntradas1;
List<Cuentas> cuentas1;
private EntradasDao mEntradasDAO;
private Entradas ENTRADAS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_entrada);
getSupportActionBar().setTitle(Html.fromHtml("<font color='#FFFFFF'>"+"Editar Entrada"+"</font>"));
getSupportActionBar().setElevation(0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
mEntradasDAO = Room.databaseBuilder(this, Database.class, "Database")
.allowMainThreadQueries() //Allows room to do operation on main thread
.build()
.entradasDao();
final Context ctx = this;
etNombre= findViewById(R.id.editText);
etSaldo= findViewById(R.id.editText4);
etFecha = (TextView) findViewById(R.id.txtFecha);
btnCalendario= (Button) findViewById(R.id.btnFecha);
btnCrear = findViewById(R.id.btnCrear);
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
}
The error is in the last line ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
it says getOne(int) in EntradasDao cannot be applied to java.lang.String
edited Nov 19 at 16:28
Kling Klang
32.2k156287
32.2k156287
asked Nov 19 at 16:18
Eduardo Noyola
435
435
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
You are putting as Int and while reading trying get as String.
Replace
mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
with
mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID,0));
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
add a comment |
up vote
0
down vote
The way to read that message is "the method getOne() accepts an int, but you are passing a java.lang.String". So you have to figure out why the value you're passing is a String.
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
In your case, though, this is pretty straightforward. You are passing it the value of a getStringExtra() call, which is always going to be a String.
There are two paths forward to fixing this. Which you choose will depend on whether or not the value you're putting into the Intent is actually a String or an int.
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
If entradas.getIdEntrada() is an int, then you can change the other side of things to simply retrieve an int extra:
ENTRADAS = mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0));
If entradas.getIdEntrada() is a String, then you will have to change the other side to retrieve the String and then parse it to an int
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt);
Edit
As mentioned in comments, the return value of the getOne() method is a LiveData<Entradas>, not just an Entradas. While this is not the recommended way to use LiveData, for the purposes of this question you can retrieve the value by calling getValue().
int idInt = getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How aLiveDataobject works is outside the scope of this question, but you can get the current value of theLiveDataby callinggetValue(). So you can sayENTRADAS = mEntradasDAO.getOne(idInt).getValue();
– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You are putting as Int and while reading trying get as String.
Replace
mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
with
mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID,0));
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
add a comment |
up vote
2
down vote
You are putting as Int and while reading trying get as String.
Replace
mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
with
mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID,0));
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
add a comment |
up vote
2
down vote
up vote
2
down vote
You are putting as Int and while reading trying get as String.
Replace
mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
with
mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID,0));
You are putting as Int and while reading trying get as String.
Replace
mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
with
mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID,0));
answered Nov 19 at 16:33
Ramesh Yankati
57838
57838
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
add a comment |
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:05
add a comment |
up vote
0
down vote
The way to read that message is "the method getOne() accepts an int, but you are passing a java.lang.String". So you have to figure out why the value you're passing is a String.
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
In your case, though, this is pretty straightforward. You are passing it the value of a getStringExtra() call, which is always going to be a String.
There are two paths forward to fixing this. Which you choose will depend on whether or not the value you're putting into the Intent is actually a String or an int.
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
If entradas.getIdEntrada() is an int, then you can change the other side of things to simply retrieve an int extra:
ENTRADAS = mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0));
If entradas.getIdEntrada() is a String, then you will have to change the other side to retrieve the String and then parse it to an int
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt);
Edit
As mentioned in comments, the return value of the getOne() method is a LiveData<Entradas>, not just an Entradas. While this is not the recommended way to use LiveData, for the purposes of this question you can retrieve the value by calling getValue().
int idInt = getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How aLiveDataobject works is outside the scope of this question, but you can get the current value of theLiveDataby callinggetValue(). So you can sayENTRADAS = mEntradasDAO.getOne(idInt).getValue();
– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
add a comment |
up vote
0
down vote
The way to read that message is "the method getOne() accepts an int, but you are passing a java.lang.String". So you have to figure out why the value you're passing is a String.
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
In your case, though, this is pretty straightforward. You are passing it the value of a getStringExtra() call, which is always going to be a String.
There are two paths forward to fixing this. Which you choose will depend on whether or not the value you're putting into the Intent is actually a String or an int.
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
If entradas.getIdEntrada() is an int, then you can change the other side of things to simply retrieve an int extra:
ENTRADAS = mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0));
If entradas.getIdEntrada() is a String, then you will have to change the other side to retrieve the String and then parse it to an int
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt);
Edit
As mentioned in comments, the return value of the getOne() method is a LiveData<Entradas>, not just an Entradas. While this is not the recommended way to use LiveData, for the purposes of this question you can retrieve the value by calling getValue().
int idInt = getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How aLiveDataobject works is outside the scope of this question, but you can get the current value of theLiveDataby callinggetValue(). So you can sayENTRADAS = mEntradasDAO.getOne(idInt).getValue();
– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
add a comment |
up vote
0
down vote
up vote
0
down vote
The way to read that message is "the method getOne() accepts an int, but you are passing a java.lang.String". So you have to figure out why the value you're passing is a String.
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
In your case, though, this is pretty straightforward. You are passing it the value of a getStringExtra() call, which is always going to be a String.
There are two paths forward to fixing this. Which you choose will depend on whether or not the value you're putting into the Intent is actually a String or an int.
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
If entradas.getIdEntrada() is an int, then you can change the other side of things to simply retrieve an int extra:
ENTRADAS = mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0));
If entradas.getIdEntrada() is a String, then you will have to change the other side to retrieve the String and then parse it to an int
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt);
Edit
As mentioned in comments, the return value of the getOne() method is a LiveData<Entradas>, not just an Entradas. While this is not the recommended way to use LiveData, for the purposes of this question you can retrieve the value by calling getValue().
int idInt = getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
The way to read that message is "the method getOne() accepts an int, but you are passing a java.lang.String". So you have to figure out why the value you're passing is a String.
ENTRADAS = mEntradasDAO.getOne(getIntent().getStringExtra(EXTRA_ENTRADA_ID));
In your case, though, this is pretty straightforward. You are passing it the value of a getStringExtra() call, which is always going to be a String.
There are two paths forward to fixing this. Which you choose will depend on whether or not the value you're putting into the Intent is actually a String or an int.
intent.putExtra(UpdateEntradaActivity.EXTRA_ENTRADA_ID, entradas.getIdEntrada());
If entradas.getIdEntrada() is an int, then you can change the other side of things to simply retrieve an int extra:
ENTRADAS = mEntradasDAO.getOne(getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0));
If entradas.getIdEntrada() is a String, then you will have to change the other side to retrieve the String and then parse it to an int
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt);
Edit
As mentioned in comments, the return value of the getOne() method is a LiveData<Entradas>, not just an Entradas. While this is not the recommended way to use LiveData, for the purposes of this question you can retrieve the value by calling getValue().
int idInt = getIntent().getIntExtra(EXTRA_ENTRADA_ID, 0);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
String idString = getIntent().getStringExtra(EXTRA_ENTRADA_ID);
int idInt = Integer.parseInt(idString);
ENTRADAS = mEntradasDAO.getOne(idInt).getValue();
edited Nov 19 at 17:16
answered Nov 19 at 16:31
Ben P.
21.7k31845
21.7k31845
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How aLiveDataobject works is outside the scope of this question, but you can get the current value of theLiveDataby callinggetValue(). So you can sayENTRADAS = mEntradasDAO.getOne(idInt).getValue();
– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
add a comment |
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How aLiveDataobject works is outside the scope of this question, but you can get the current value of theLiveDataby callinggetValue(). So you can sayENTRADAS = mEntradasDAO.getOne(idInt).getValue();
– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
Now it says Incompatible types Required: Entities.Entradas Found: lifecycle.LiveData
– Eduardo Noyola
Nov 19 at 17:10
How a
LiveData object works is outside the scope of this question, but you can get the current value of the LiveData by calling getValue(). So you can say ENTRADAS = mEntradasDAO.getOne(idInt).getValue();– Ben P.
Nov 19 at 17:14
How a
LiveData object works is outside the scope of this question, but you can get the current value of the LiveData by calling getValue(). So you can say ENTRADAS = mEntradasDAO.getOne(idInt).getValue();– Ben P.
Nov 19 at 17:14
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
Thanks but now I'm getting null in the other activity
– Eduardo Noyola
Nov 19 at 20:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378757%2fhow-to-pass-an-int-data-with-an-intent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown