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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:21:20+00:00 2026-06-05T18:21:20+00:00

So I’m using Parse for now to run the backend of my app. When

  • 0

So I’m using Parse for now to run the backend of my app. When you query your Parse database, data is returned in a seemingly weird way (to me, but I’m new to this) –

            query.getFirstInBackground(new GetCallback() {
            public void done(ParseObject object, ParseException e) {
              if (object == null) {
              } else {
              }
            }
          });

And the data from the query is available for example within the Else statement. I can do Date time = object.getCreatedAt(); to get the time the retrieved object was created at.

But, the problem comes about because I want to use that data to update the text of a textView within my app. I feel like the data is “stuck” inside the callBack (which I realize is probably not true. The way I’m trying to do it I get an error: “Cannot refer to a non-final variable updateText inside an inner class defined in a different method”. The error is on updateText, timeText, table, and i. Here is the relevant code snippet that is failing –

TableLayout table = (TableLayout) findViewById(R.id.tableLayout);
    TextView courtText;
    TextView updateText;
    TextView timeText;
    // For each row
    for (int i = 0; i < table.getChildCount(); i++) {
        // Get the one `courtText` in this row
        courtText = (TextView) table.getChildAt(i).findViewById(R.id.courtText);

        ParseQuery query = new ParseQuery("Updates");
        query.whereEqualTo("court",courtText);
        query.orderByAscending("createdAt");
        query.getFirstInBackground(new GetCallback() {
            public void done(ParseObject object, ParseException e) {
              if (object == null) {
                Log.d("update", "The getFirst request failed.");
              } else {
                Log.d("update", "Retrieved the object.");

                String update = object.getString("update");
                Date time = object.getCreatedAt();

                updateText = (TextView) table.getChildAt(i).findViewById(R.id.updateText);
                timeText = (TextView) table.getChildAt(i).findViewById(R.id.timeText);

                updateText.setText(update);
                java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
                timeText.setText(dateFormat.format(time));
              }
            }
          });

    }

Any help would be appreciated.

  • 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-05T18:21:22+00:00Added an answer on June 5, 2026 at 6:21 pm

    I’m not able to test it right now, but something like this should work:

    final TableLayout table = (TableLayout) findViewById(R.id.tableLayout);
    TextView courtText;
    
    for (int i = 0; i < table.getChildCount(); i++) {
        courtText = (TextView) table.getChildAt(i).findViewById(R.id.courtText);
        final TextView updateText = (TextView) table.getChildAt(i).findViewById(R.id.updateText);
        final TextView timeText = (TextView) table.getChildAt(i).findViewById(R.id.timeText);
    
        ParseQuery query = new ParseQuery("Updates");
        query.whereEqualTo("court",courtText);
        query.orderByAscending("createdAt");
        query.getFirstInBackground(new GetCallback() {
            public void done(ParseObject object, ParseException e) {
                if (object == null) {
                    Log.d("update", "The getFirst request failed.");
                } else {
                    Log.d("update", "Retrieved the object.");
    
                    String update = object.getString("update");
                    Date time = object.getCreatedAt();
    
                    updateText.setText(update);
                    java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
                    timeText.setText(dateFormat.format(time));
                }
            }
        });
    }
    

    This way the only two variables from outside the inner class that need to be accessed from inside it (updateText and timeText) are declared final, so everything should work.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.