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

  • Home
  • SEARCH
  • 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 1017993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:47:25+00:00 2026-05-16T10:47:25+00:00

I have a simple form where a user can add, edit, and delete people

  • 0

I have a simple form where a user can add, edit, and delete people from a list. When a user has chosen to edit a person it executes startActivityForResult so it can make the appropriate changes and refresh the list once the edit is complete. If the user clicks the back button from the edit screen a force close error appears.

I believe it has something to do with the system expecting a result, and I’m not trapping it properly. How would I trap this error?

Here is the onActivityResult code currently in place:


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
 super.onActivityResult(requestCode, resultCode, intent);
 Bundle extras = intent.getExtras();
 switch(requestCode) {
 case ACTIVITY_CREATE:
  String person = extras.getString("person");
  mDbHelper.addPerson(person);
  fillData();
  break;
 case ACTIVITY_EDIT:
  Long rowId = extras.getLong("_id");
  if (rowId != null) {
   String editPerson = extras.getString("person");
   mDbHelper.updatePerson(rowId, editPerson);
  }
  fillData();
  break;
 }
}

Thank you for any help.

  • 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-05-16T10:47:26+00:00Added an answer on May 16, 2026 at 10:47 am

    First of all, look at your stack trace using DDMS, it will tell you what line the Exception is occurring on.

    What you can do in your calling activity is check for the resultCode, and in your callee activity set it using setResult().

    For example, if the user pressed back the resultCode will be RESULT_CANCELED. If this is the case do not try to extract data from the intent.

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

Sidebar

Related Questions

I have a pretty simple MVC 2 form. It has two dropdowns, user and
I have a simple form on a view page, implemented as a user control,
I have an HTML page with a simple form. When the user clicks submit,
I have a form to edit employee information. If the user wishes to enter
I have a user control on a form that can spawn several non-modal child
I have a simple ASP.net page where users can edit information about themselves. When
I have a simple MS Access form that has 3 objects: a text box,
I have a pretty simple HTML form where users can enter in information about
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
Have a simple form (only extract fields here) but for some reason the JQserilization

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.