In my android app I have the following code:
public void goToCaptureBonus (View View) {
String tappedBonus = ((TextView) findViewById(R.id.bonusListCode)
The documentation of findViewById() says
Finds the first descendant view with the given ID, ...
Is it possible that you are using findViewById()
from the context of the activity or the the general list view and not of the selected (tapped on) view?
If the view
parameter of your function is the tapped on view, you should probably do:
view.findViewById(R.id.bonusListCode)
instead of just
findViewById(R.id.bonusListCode)