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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:01:53+00:00 2026-05-26T01:01:53+00:00

When The user Click on the button it want to call the dialog- that

  • 0

When The user Click on the button it want to call the dialog- that dialog contain list of product in ListView.After user slect the product it should come to previuous activity.

I have done using startActivityForResult ().

There aresome issue.My calling activity is in normal tab activity that normal tab activty in Tab Activity Group.

Actualy i want to do in drrop down(Spinner).In my scanerio i couldn’t get context.It awalys give Android Spinner Error : android.view.WindowManager$BadTokenException: Unable to add window

So I have change to my design like this: When User click buttion it load the list of product in ListView.After pick the product, it come back to previous activity.

This is my previous question : link

Here calling activity:

  //Click Product button
   l_prod.setOnClickListener(new OnClickListener() {
       public void onClick(View v) {
            Intent showContent = new Intent(LineDiscountActivity.this,ListProductActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("Activity", "LineDiscountActivity");
            bundle.putString("RetailerName", retailerName);
            bundle.putString("RetailerCode", retailerCode);
            showContent.putExtra("discountProduct", discountList);
            showContent.putExtras(bundle);
            getParent().startActivityForResult(showContent, 5);
       }
   });

And my receiver activity :

  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
            Object o = this.getListAdapter().getItem(position);
            String book = o.toString();
            Intent i = new Intent();
            Bundle bundle = new Bundle();
            bundle.putString("Activity", "ListProductActivity");
            bundle.putString("RetailerName", retailerName);
            bundle.putString("RetailerCode", retailerCode);
            bundle.putString("seletcedProductCode", products.get(position).getProductCode());
            bundle.putString("seletcedProductName", products.get(position).getDescription());
            bundle.putDouble("seletcedProductQty", products.get(position).getAvailableQuantity());
            i.putExtra("discountProduct", discountList);
            i.putExtras(bundle);
            if (getParent() == null) {
                setResult(Activity.RESULT_OK, i);
            } else {
                getParent().setResult(Activity.RESULT_OK, i);
            }
            ListProductActivity.this.finish(); 

    }

And calling activity

 @Override
protected  void onActivityResult(int requestCode, int resultCode, Intent data) {
//  super.onActivityResult(requestCode, resultCode, data);
    Log.i("-requestCode from LineDisocunt--" ,"" + requestCode);

}

I have written this code(onActivityResult) in calling activity & Tab main Activty also.

I didn’t go anywhere..

onActivityResult mehtod.But it didn’t go it.

What is wrong in my code.

Please let me know if anybody know this…

Thanks in advance

  • 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-26T01:01:53+00:00Added an answer on May 26, 2026 at 1:01 am

    I have same issue when I was using startActivityForResult() with activity group.

    your activity result will go to your activity group.You will not get activity result in your first activity

    So you can solve this issue by taking one public static object in your first activity and when you call second activity you have to assign your first activity object from second activity.and then finish second activity so that your first activity will resume and you can update your ui by overriding onResume() method in first activity.You have to check validation weather your object is assigned or not.

    For example

    You have one static object product in your first activity

    First Activity

    public static Product product;
    start second activity
    startactivity(this, SecondActivity.class);
    
    don't finish First Activity
    

    You have to override onResume() method and then you can use product object which is assigned by second activity

    second activity

    FirstActivity.product.setName(name);
    FirstActivity.product.setPrice(price);
    

    After assign the product object you have to finish second activity
    like

    finish()
    

    EDIT

    I got the solution for your issue of badTokenException

    Here is the solution

    CLICK HERE

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

Sidebar

Related Questions

Suppose, I want to have a link or a button that when user click
I don't want to allow user to double click on my button. On the
I have button on form2. i want when user click this button make something
The work flow: user click the button, a dialog box opens with a search
On submit button i want to disable the button so user does not click
When a user clicks a submit button I want the form to be submitted.
In my application when a user clicks on a button I want to open
When the user clicks a button, I want his browser to automatically scroll to
I want to, when the user clicks a button on my website, to make
When the user clicks an Edit button on my form, I want a box

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.