1

I'm having some issues with this: I have an activity (Activity1) where I choose an int (from 0 to 5) by clicking on a fab button. As I click one of the six fab, a new Activity is created, let's call it Activity2. In the Activity2 I can see the value of the fab button previously clicked inside a textview. In Activity2 there is another button that allows me to go in a third activity (Activity3) where a listview shows me some items. This list is filled by an adapter which manages all imageviews, textviews and buttons of each item of the list. Now when I click on one of the item a pop-up is shown and in the pop-up layout a button is present. When I click on the button inside the pop up window I would be able to go back in the Activity2 remembering the value of the int I choose at the beginning. I'm now going in activity2 from the adapter by using the following, but because of the flag a new activity1 is created and my int is not the one I chose

Button eatnow= (Button)box.findViewById(R.id.EatNow_btn);
        eatnow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //send the selected recipe name to the InsertFoodActivity to perform the intake
                Recipe REC;
                REC=(Recipe)getItem(position);

                Intent intakeIntent= new Intent(mContext, InsertFoodActivity.class);
                intakeIntent.putExtra("RecipeName", REC.getRec_name());
                //intakeIntent.putExtra("selected",selected);
                intakeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                getContext().startActivity(intakeIntent);

                popUpWndw.dismiss();
            }
        });
NioAnt
  • 13
  • 2

0 Answers0