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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:52:54+00:00 2026-05-27T15:52:54+00:00

I’ve been working on a GUI for and Android app. Everything was going ok

  • 0

I’ve been working on a GUI for and Android app. Everything was going ok when I suddenly was caught off guard by a simple task:
I have an activity. Inside, I have a list view. What I want to do is: when item from the ListView is clicked – open Dialog containing more information about this position. Well, showing a Dialog is kinda easy, but the problem is that I can’t change f.e. the Title. Why? Here’s my code:

public class SzukajActivity extends Activity {
private ListView searchResultsListView;
private String DB[] = {"Blah", "Bleh", "Boing", "Quing", "Something"};
private ArrayList<String> searchResults = new ArrayList<String>();
private EditText searchNameEditText;
private ArrayAdapter<String> searchListViewAdapter;
private TextView prowadzacyName;
private AlertDialog prowadzacyDialog;
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    LayoutInflater searchFactory = LayoutInflater.from(this);
    final View searchView = searchFactory.inflate(R.layout.search, null);
    setContentView(searchView);

    // prowadzacySite Dialog
    LayoutInflater prowadzacySiteFactory = LayoutInflater.from(this);
    final View prowadzacyDialogView = prowadzacySiteFactory.inflate(R.layout.prowadzacy_site, null);
    prowadzacyName = (TextView) findViewById(R.id.prowadzacyname);
    //prowadzacyName.setText("a KUKU!");
    AlertDialog.Builder prowadzacyDialogBuilder = new AlertDialog.Builder(this);
    prowadzacyDialogBuilder.setTitle("Prowadzacy")
                      .setCancelable(false)
                      .setView(prowadzacyDialogView)
                      .setPositiveButton("Zapisz się", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int id) {
                                dialog.cancel();
                           }
                       })
                       .setNegativeButton("Zakoncz", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int id) {
                                dialog.cancel();
                           }
                       });
    prowadzacyDialog = prowadzacyDialogBuilder.create();

    searchResultsListView = (ListView) findViewById(R.id.searchKurczeBladeView);
    searchListViewAdapter = new ArrayAdapter<String>(this, R.layout.spotkanialistitem, searchResults);
    searchResultsListView.setAdapter(searchListViewAdapter);
    searchResultsListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            prowadzacyName = (TextView) findViewById(R.id.prowadzacyname);
            if(prowadzacyName == null) Toast.makeText(SzukajActivity.this, "BOOOOM!", Toast.LENGTH_SHORT).show();
            //prowadzacyName.setText("A KUKU!");

            prowadzacyDialog.show();
        }
    });
    searchNameEditText = (EditText) findViewById(R.id.searchName);
    searchNameEditText.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER))
            {
                searchResults.clear();
                for(int i = 0; i < 5; ++i)
                {
                    if(DB[i].contains(searchNameEditText.getText()))
                    {
                        searchResults.add(DB[i]);
                    }
                }
                if(searchResults.size() == 0)
                    Toast.makeText(SzukajActivity.this, "Nie znaleziono odpowiadających prowadzących", Toast.LENGTH_SHORT).show();
                searchListViewAdapter.notifyDataSetChanged();
                return true;
            }
            else
                return false;
        }
    });

}
}

The direct problem is that in onItemClick function, I want to access prowadzacyName which is a TextView from a Dialog layout. It will always be null, because I set setContentView(searchView). I do it because it’s the layout of my activity.

Is there a possible way to access those elements, or rather any other way to get what I want? (I thought about Dialog being an other Activity, but it sounds creepy to me – another activity for every possible dialog?! :p)

  • 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-27T15:52:54+00:00Added an answer on May 27, 2026 at 3:52 pm

    As per my knowledge ,you used

        final View searchView = searchFactory.inflate(R.layout.search, null);
        setContentView(searchView);
    

    If you want to access the child view in this case use

      prowadzacyName = (TextView)searchView.findViewById(R.id.prowadzacyname);
    

    I think this may solve your problem.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.