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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:46:11+00:00 2026-06-01T13:46:11+00:00

NEWBIE ALERT! Here’s the situation. I’ve got an Android ListActivity class (AppWindow) that contains

  • 0

NEWBIE ALERT!

Here’s the situation. I’ve got an Android ListActivity class (AppWindow) that contains all the methods that create and update the UI for my application. It includes a method (refreshWindow) that calls setListAdapter, and therefore must be non-static. So far, I’ve been using a separate class (FileHandler) to perform manipulations on files that are referenced by the AppWindow class. I’ve reached a point where I want to call the refreshWindow method when a certain file manipulation has been performed. However, since the refreshWindow method is non-static, it seems that I would need to instantiate AppWindow and call the method through that instance. However, I’m not sure how to do this or if it’s even a good idea. Perhaps I just need to move all of the FileHandler logic into AppWindow, although I’d prefer to keep them separate.

Here’s a description of the situation in code form:

AppWindow.java

...

public class AppWindow extends ListActivity {

...

    void refreshWindow() {

    ...

    setListAdapter(new ListAdapter());

    ...

    }

...

}

FileHandler.java

...

class FileHandler extends Activity {

...

    static void doStuffToFiles() {

    ...

    AppWindow appWindow = new AppWindow();
    appWindow.refreshWindow();

    ...

    }

...

}

Should I be doing this? If so, how do I properly instantiate AppWindow?

  • 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-01T13:46:13+00:00Added an answer on June 1, 2026 at 1:46 pm
    1. Create a static member variable; say act; in FileHandler
    2. On creation of ListActivity set the variable act using ‘this’ variable of activity
    3. Now you can access activity instance from FileHandler.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Newbie DBUnit question Alert!) It appears that DBUnit for each table 'deletes all the
[Android Newbie alert] I need to capture the contents of a WebView in a
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Here's my situation: I have a UserBadge object in ASP.NET, it contains 3 fields,
Newbie Alert: while working on my android application my program was acting kind of
newbie alert here! I want to load some content of my site with ajax
Newbie alert... I'm trying to make an educational that uses different audio players (with
****C newbie alert**** How do I compile a C app so that it runs
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
Newbie question here. I'm in the beginning stages of laying out a site in

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.