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 3343760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:59:30+00:00 2026-05-18T00:59:30+00:00

EDIT: I have figured out my main issue, but still have one concern. Everything

  • 0

EDIT: I have figured out my main issue, but still have one concern. Everything below this paragraph has been solved. I am now able to populate fields on one activity after selecting from a list in the other. The only problem is that after I “quick add”, I get stuck with the quick add screen between two versions of the other screen. In other words, say I press the quick add button and my listview activity comes up. When I select an item, it essentially goes forward and creates another instance of the original activity. So if you hit the back button, you have to go back through the listview, then back to the original instance of the original activity. Is there any way to avoid this?

I have a button in one activity that opens a list view in another that’s populated with two columns from a database – name and price (this was modeled on the Notepad tutorial). The list is meant as a “quick add” option. What I want it to do is, when pressed, populate the “name” and “price” EditTexts in the previous activity with the corresponding database entry.

So as per the tutorial, this is what I have in my ItemPicker class:

 @Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Cursor c = mNotesCursor;
    c.moveToPosition(position);
    Intent i = new Intent(this, NewEntry.class);
    i.putExtra(ItemsDbAdapter.KEY_ROWID, id);
    i.putExtra(ItemsDbAdapter.KEY_NAME, c.getString( 
            c.getColumnIndexOrThrow(ItemsDbAdapter.KEY_NAME)));
    i.putExtra(ItemsDbAdapter.KEY_PRICE, c.getString(
            c.getColumnIndexOrThrow(ItemsDbAdapter.KEY_PRICE)));
    startActivityForResult(i, ACTIVITY_AUTO);

}

I’m completely lost when it comes to retrieving that info in the NewEntry class. I figure it’s a matter of getting the extras, but I don’t even know how to start formatting the code.

Also, I need it to switch back to the NewEntry class activity automatically. Is that as easy as adding a startActivity() to this method? Thanks.

EDIT: Nevermind, figured this one out finally. Here’s the code in my other activity:

Bundle extras = getIntent().getExtras();
    if (extras != null) {
        editName.setText(extras.getString(ItemsDbAdapter.KEY_NAME));
        editPrice.setText(extras.getString(ItemsDbAdapter.KEY_PRICE));
    }
  • 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-18T00:59:31+00:00Added an answer on May 18, 2026 at 12:59 am

    WHy can’t you just use finish() on the listactivity?

    THat’s what I do here… Or maybe I didn’t understand your problem.

    Don’t use startactivityforresult on the second activity. Just use finish(). 😉

    // edited:

    And by the way, you don’t create a new Intent. You use Intent i = getIntent(); to get the original Intent. You’re doing it wrong!

    The purpose of the Intent on the second class is not to start another activity. It is to return the results to the original intent. Think of intents as bridges. When you are at the other side you don’t create a new bridge, you return the results to the original bridge and return (finish()) from it.

    That’s why you need Intent i = getIntent() instead of new Intent, and finish() instead of startactivityforresult (which creates a new bridge instead of returning from the first one).

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

Sidebar

Related Questions

I have given up tryng to figure out the reason of this issue, but
Edit: I have solved this by myself. See my answer below I have set
I have found a few libraries to edit MP3 tags (UltraID3Lib is great) but
I have a compiled swf file and a I can't edit it , but
( Edit : to clarify, my main goal is concurrency, but not necessarily for
I have seen this: <classpathentry excluding=** kind=src output=target/classes path=src/main/resources/> In my Eclipse .classpath file
I realize that this is probably a very basic question, but I have spent
EDIT: I have submitted a bug report and Microsoft have acknowledge that it is
EDIT: I have added Slug column to address performance issues on specific record selection.
What are extension methods in .NET? EDIT: I have posted a follow up question

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.