Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8086885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:35:19+00:00 2026-06-05T18:35:19+00:00

My app starts up at Activity A which contains a ListView. The ListView can

  • 0

My app starts up at Activity A which contains a ListView. The ListView can have items added to it if the user hits “Add” button and goes to Activity B.

In Activity B they fill out some forms and hit “OK” button which takes them back to Activity A where the new item is added to the ListView.

I have a finish() method after going from B to A — but NOT the other way around.

So if you hit back three times after adding three items. It will just repeat the ListView (Activity A) over 3 times — less one item that was added.

What is the best way in doing this? I can’t put a finish method on the “Add” Button (going from A to B) because if you are in Activity B, it will close the app instead of taking you back to A — which I do not want. That is, if the user changes his mind and doesn’t want to “Add new item” by hitting “OK” while in B. Is a manual Back button the only answer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:35:21+00:00Added an answer on June 5, 2026 at 6:35 pm

    Start Activity B by using startActivityForResult() and finish activity B after filling the form.

    EDIT

    When you startActivityForResult(), you pass 2 parameters, namely intent and requestcode. After you are finished with the new activity(in your case Activity B) you use a function setResult(RESULT_OK) to signify that the operation in Activity B was successful and then you call finish(). After the call to finish() the Activity B will return to Activity A and will call onActivityResult(int requestCode, int resultCode, Intent data). The parameter requestcode helps in identifying which particular activity/request has returned.

    Hope this explanation helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app which contains an activity which is a MapviewActivity and is
I have a winforms app that checks user credentials as it starts. If autharization
I have got Sinatra/Rails app and an action which starts some long process. Ordinary
Here's the problem. In my app, I have 5 tabs which contains activities. In
I am developing an app widget that starts one activity which changes layout of
I'm making an app which has a flow roughly as below: User starts on
I currently have a listview which contains a couple of strings. These are called
I have android app in which one layout contains Linearlayout , ScrollView , TextView
I have two java files. In the first I have my activity which starts
I have an app which has a main activity that calls other activities on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.