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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:58:23+00:00 2026-05-27T22:58:23+00:00

Currently when I click my button it uses the method startActivityForResult(); It finds the

  • 0

Currently when I click my button it uses the method startActivityForResult(); It finds the answer and returns.

The only problem is once it returns it will start the activity again. Personally I think its completely pointless to have a method that can only be run once. Surely there must be a flag that can be given to the method in order to tell it to run as many times as wanted?

I’ve read the javadoc and it doesn’t seem to help because it says its a one time use, unless I’m reading it wrong?

IN MY SEARCH ACTIVITY:

private OnItemClickListener listListener = new OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        // TODO Auto-generated method stub
        String text = (String) ((TextView) arg1).getText();
        String[] selected = text.split(" - ");
        selected[0] = selected[0].replace(' ', '_');
        Log.w("COMPANY", selected[0]);
        Log.w("PART", selected[1]);

        Intent data = new Intent();
        data.putExtra("key", selected);
        setResult(RESULT_OK, data);

        finish();

        // startActivity(switch2);
    }

};

IN MY MAIN ACTIVITY
(IN Button LISTENER)

if (search.isPressed() && searchPressed == false) {
            // show search list
            Intent switch1 = new Intent(MainActivity.this, SearchActivity.class);

            startActivityForResult(switch1, 0);

        }

@Override
protected void onActivityResult(int req, int resp, Intent data) {
    super.onActivityResult(req, resp, data);

    searchPressed = true;
    Bundle searched = data.getExtras();
    String[] newItem = searched.getStringArray("key");

    if (newItem[0].endsWith("_")) {
        handleXML(1);
        tv1.setText("Higher");
        tv2.setText("Lower");
    } else {
        handleXML(0);
        tv1.setText("Wear Resistance");
        tv2.setText("Tougher");
    }
    competitors = h.competitors;
    String[] piece = competitors.findCompanyParts(newItem);
    assignMaterials(piece);

    window.setVisibility(VISIBLE);
    grade.setVisibility(INVISIBLE);
    geo.setVisibility(INVISIBLE);
    s1.setVisibility(INVISIBLE);
    s2.setVisibility(INVISIBLE);
    search.setVisibility(INVISIBLE);
    help.setVisibility(INVISIBLE);
    myTabHost.setCurrentTab(0);
}
  • 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-27T22:58:24+00:00Added an answer on May 27, 2026 at 10:58 pm

    You are definitely doing something wrong.
    The method simply launches another activity. There is no real difference between startActivity() and startActivityForResult() other than that the second one has the option of being attached to a callback that will listen for some returned values from the launched Activity once that one has finished.
    You should paste in some code to show us what you’re doing and I’m sure we’ll quickly point out where you’ve gone wrong.

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

Sidebar

Related Questions

I currently have a simple form that when you click the save button will
I have a form that uses jQuery Validate. You click the Submit button, form
I'm currently using this method in calling batch files in vb.net: Private Sub Button3_Click(ByVal
Currently i have this: $(.splitCol).click(function () { $.cookie('whichColumn', 'split'); $(.threeCol .active).removeClass(active); $(.leftCol .active).removeClass(active); $(.splitCol
I'm currently trying to do the following: Trigger: click on a name in a
I'm currently doing the following to use typed datasets in vs2008: Right click on
I am currently using SQL Server Management Studio (Ver 9.00.3042.00) and click the New
Example: http://vincent-massaro.com/map/ Currently, the script allows you to click on a piece of the
I am using jScrollPane to scroll a div. Currently the default is to click
I'm currently working with a part of my application that uses Dynamic Web User

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.