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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:03:02+00:00 2026-06-05T06:03:02+00:00

Let me preface that I’m new to programming for Android. I’ve been doing my

  • 0

Let me preface that I’m new to programming for Android. I’ve been doing my due diligence to research to no avail. I have the source code below and I’m having issues with returning the value for returning.

I have the code laid out on eclipse and it’s not triggering any errors. But when I build the code below, it comes back with an error. After inspecting the values in debug view, I can see the proper values just not binded to the TextView.

public class MyFirstActivity extends Activity {
/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      calculateResult(2012, 9, 29);
  }
  private void calculateResult(int year, int month, int day) {
      long days = 0L;
      int returning = 0;

      java.util.Calendar cal = new java.util.GregorianCalendar(year, month-1, day);

      long todayMI = new java.util.Date().getTime();
      long calMI = cal.getTimeInMillis();
      long millDiff = calMI - todayMI;

      if (millDiff < 0) {
            returning = 0;
      } else {
            days = millDiff / 1000 / 60 / 60;
            returning = (int) Math.ceil(days / 24f);
      }

      TextView days_int_remaining = (TextView) findViewById(R.id.days_int_remaining);
      days_int_remaining.setText(returning);
  }
}

If it helps, here’s the TextView on my layout XML:

<TextView
      android:id="@+id/days_int_remaining"
      android:layout_height="wrap_content"
      android:layout_width="wrap_content"
      android:layout_gravity="center_horizontal|center_vertical"
      android:shadowColor="#5000"
      android:shadowDx="4"
      android:shadowDy="3"
      android:shadowRadius="1"
      android:textColor="#fff"
      android:textSize="70dip"
      android:textStyle="bold"
/>

It may be something simple that I’m missing. Anything to help me further understand the code is 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-05T06:03:05+00:00Added an answer on June 5, 2026 at 6:03 am

    just use

    TextView days_int_remaining = (TextView) findViewById(R.id.days_int_remaining);
    days_int_remaining.setText(String.valueOf(returning));
    

    instead of

    TextView days_int_remaining = (TextView) findViewById(R.id.days_int_remaining);
    days_int_remaining.setText(returning);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me preface this by saying that I'm pretty new to Java. I have
Let me preface by saying that I'm new to ant, and I'm using version
First, let me preface this by saying that I'm brand-new to Ember.js and relatively
Let me preface this with the disclaimer that I am very new to multithreading
I'll preface this with the fact that I'm new to RoR. I have a
Preface Let me start off by saying that I'm a relatively new programmer and
Let me preface this with saying that I am new to Ruby. I was
Let me preface this question with first stating that I'm new to GUI interfaces:
First let me preface this question by saying that I'm fairly new to Javascript.
Let me preface this by saying I'm rather new to source control, so I

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.