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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:18:03+00:00 2026-06-08T21:18:03+00:00

I have an app with fragments working ok, I have a view with buttons,

  • 0

I have an app with fragments working ok,

I have a view with buttons, when a button gets tapped, a popup view is showed,

but I need to set different text on the pop up view for each button that is pressed.

Im new to android and java and just realised I don’t understand how to send the data to the pop up view, to set the text on the xml for the pop up view,

public class Tab2HeadH1 extends Fragment   implements OnClickListener{

    //testeo popero


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {



        View view = inflater.inflate(R.layout.tab_2_head_buttons, container,false);



        //Buttons

        final Button buttonNose = (Button) view.findViewById(R.id.button_pop_nose);

        buttonNose.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(final View v) {
              //aqui tus tareas,,

                LayoutInflater layoutInflater = (LayoutInflater)getActivity().getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

               View popupView = layoutInflater.inflate(R.layout.popup, null);  
                        final PopupWindow popupWindow = new PopupWindow(
                          popupView, 
                          LayoutParams.WRAP_CONTENT,  
                                LayoutParams.WRAP_CONTENT);

                        Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss);
                        btnDismiss.setOnClickListener(new Button.OnClickListener(){

                @Override
                public void onClick(View v) {
                 // TODO Auto-generated method stub
                 popupWindow.dismiss();
                }});

                        popupWindow.showAsDropDown(buttonNose, 50, 30);




            }



        });





        Button buttonEye = (Button) view.findViewById(R.id.button_pop_eye);

        buttonEye.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(final View v) {
               // onLoginClicked(v);
                Toast.makeText(getActivity(), "ss9 eye",
                        Toast.LENGTH_SHORT).show();

            }
        });

return view;
    }



    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {

        super.onViewCreated(view, savedInstanceState);



        ((TabActivity)getActivity()).setHeader("TAPING APPLICATION");
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {



        }
    }


}

and the xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:background="@android:color/background_light">
 <LinearLayout 
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:orientation="vertical" 
     android:layout_margin="1dp"
     android:background="@android:color/darker_gray">
     >
     <LinearLayout 
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical" 
      android:layout_margin="20dp">
      <TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="It's a PopupWindow" />
      <ImageView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:src="@drawable/ic_launcher" />
      <Button
          android:id="@+id/dismiss"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Dismiss" />
      </LinearLayout>
 </LinearLayout>
</LinearLayout>

So how can I set the text of the textView,

Thanks a lot!

  • 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-08T21:18:04+00:00Added an answer on June 8, 2026 at 9:18 pm

    you need to find your textView in popup layout and set popup text

    TextView text = popupView.findViewById(R.id.popup_text);
    text.setText(your text);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that uses fragments, its working ok, but I have now
I have an app with fragments working ok, now I need to implement some
I have an android app, working fine with fragments, I need to show a
have an app that finds your GPS location successfully, but I need to be
I am working on android app and am trying to get fragments working but
I have an app that uses the ActionBar with tabs in combination with Fragments.
In my android app I have fragments, and one of them is very heavy
I have the following structure in my app: FragmentActivity with ViewPager holding multiple fragments
I'm working on an android app which has different layouts for phone vs tablet.
I am experiencing some weird behavior with an android app I have been working

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.