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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:12:57+00:00 2026-06-08T23:12:57+00:00

In my application i have 3 text view arranged horizontally,1st previmage,2nd date,3rd nextimage.Now,when i

  • 0

In my application i have 3 text view arranged horizontally,1st previmage,2nd date,3rd nextimage.Now,when i click the 1st textview i should should display the previous month,(its printing) when once again i click means it should go to 2nd previous month of current month and this should go on..But when i click 2nd time it is coming the 1st previous month only its doesn’t going backwards..Please help me.Thanks in advance..

This is my code:

prvmon.setOnClickListener(new View.OnClickListener() 
    {       
        @Override
        public void onClick(View arg0) 
        {
            // TODO Auto-generated method stub
            System.out.println("Inside left");
            TextView date=(TextView)findViewById(R.id.date);
            Calendar cal= Calendar.getInstance();
            cal.add(cal.MONTH,-1);
            Date date1=cal.getTime();
            System.out.println("sssssss="+date1);
            cal.setTime(date1);
            SimpleDateFormat month_date = new SimpleDateFormat("MMMMM yyyy");
            String month_name = month_date.format(cal.getTime());  
            date.setText(month_name);   
        }
    });
  • 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-08T23:12:59+00:00Added an answer on June 8, 2026 at 11:12 pm

    The reason is that you are initializing your Calender instance everytime. So, its taking the current date/time instance. So, better would be initialize in once and use it again. Declare it globally and initialize it in onCreate().

    Calendar calendar = null;
    
    protected void onCreate(Bundle savedInstanceState){
    
    calendar = Calendar.getInstance();
    ...
    }
    

    now, use this calender instance in your onClick() event.

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

Sidebar

Related Questions

In my application,i have text view with long text. i need text wrapping like
hai all, in my iphone application i have a login view with two text
Hi All, I have a web-view in my application which displays some text with
Now I am doing an application.In my app I have to change textview value
In my application I have few views with longer text. In my detail view
in my web application i have grid view control with edit property true. Now
My Application have 5 activities(A1,A2,A3,A4,A5). Each activity have one text view and one button(B1,B2,B3,B4,B5).
In my application i have to show an image in my text view. Also
In my music player application, I have got a TextView with Artist, Title and
In my application, I have a listview whose list item consists of a TextView

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.