0
String[] items =  {"Yes","No"};

@Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  String item = parent.getItemAtPosition(position).toString();
  Toast.makeText(getApplicationContext(),"Item: "+item,Toast.LENGTH_SHORT).show(); }

How to display a result in next activity? I want to make a drop-down and if I choose yes, a result must show when I press confirm.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Carl
  • 57
  • 5
  • 1
    It depends. It might as simple as declaring a field (a variable) in the enclosing class and assigning `item` to it. I recommend that you find / read a tutorial on writing Android apps. – Stephen C Jan 01 '22 at 02:15
  • I am trying to fin a way to store this value of yes, then it must show some result in the next activity. – Carl Jan 01 '22 at 02:16
  • 2
    So ... explain clearly what you are trying to do **in the question**. Use the **edit** button. – Stephen C Jan 01 '22 at 02:20
  • 1
    But I suspect that this is just a duplicate of (for example) https://stackoverflow.com/questions/2091465. – Stephen C Jan 01 '22 at 02:23
  • Unfortunately I'm not being able to edit it one more time... Can you give me a hint so I can google more? I did a dropdown menu asking a question, what I'm trying to do is when I choose yes, a specific answer shows in the next activity. – Carl Jan 01 '22 at 02:24
  • 1
    Why are you not able to edit it? Can't you find the edit link??? See the line of tags? See the line under that? See the grey "Edit" ? – Stephen C Jan 01 '22 at 02:25
  • It only show me this! Approve, reject, or improve this suggested edit. – Carl Jan 01 '22 at 02:26
  • Sir in my case I would like to to ask a question and have a dropmenu with yes or no. If I choose yes then a result show in other activity. Can you give me a hint on what to google? Thank you! – Carl Jan 01 '22 at 02:52
  • Should I declare that yes is equal to something? I want to show the result that comes from the answer yes. – Carl Jan 01 '22 at 03:01
  • 1
    Maybe. I'm not understanding what you are saying. I think you would be better off reading a tutorial on Java programming and another on writing Android apps in Java. StackOverflow is NOT a tutoring / teaching service. – Stephen C Jan 01 '22 at 03:03
  • Im sorry for being kind of ignorant... WHat I meant is, there is a dropdown and has question like what is the month you born? If the user choose January then a result comes in the next activity like you are capricorn. Thanks for replying. – Carl Jan 01 '22 at 03:06
  • 1
    Try the answers in the link in Stephen's comment. That's how you pass data. Otherwise, add more info to the question. – private static Jan 01 '22 at 08:46
  • Thank you I edited, hopefuly it comes with an answer :) – Carl Jan 01 '22 at 16:27

0 Answers0