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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:16:42+00:00 2026-06-10T05:16:42+00:00

I am developing a quotes app that has next/previous, and copy buttons. this is

  • 0

I am developing a quotes app that has next/previous, and copy buttons.

this is the code :

    Button btn1;
     String countires[];
     int i=0;
        /** Called when the activity is first created. */
     @Override
      public void onCreate(Bundle savedInstanceState)
     {
     super.onCreate(savedInstanceState);
         setContentView(R.layout.prob2);

btn1 = (Button) findViewById(R.id.prob2_btn1);

countires = getResources().getStringArray(R.array.country);

for (String string : countires)
{
    Log.i("--: VALUE :--","string = "+string);
}

btn1.setOnClickListener(new OnClickListener()
{
    @Override
    public void onClick(View arg0)
    {
        // TODO Auto-generated method stub
        String  country  = countires[i];
        btn1.setText(country);
        i++;
        if(i==countires.length)
            i=0;
    }
});
}

I need the onClick code for “previous” button to show previous string in textView ???

  • 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-10T05:16:44+00:00Added an answer on June 10, 2026 at 5:16 am

    create a new member for your Activity like:

    int actual = 0;
    

    Then create a ‘next’ button:

    nextButton = (Button) findViewById(...);
    
    nextButton.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View arg0)
        {
            actual = actual < countires.length - 1 ? actual + 1 : actual;
            String  country  = countires[actual];
            btn1.setText(country);
        }
    });
    

    Same goes for the previous button:

    prevButton = (Button) findViewById(...);
    
    prevButton.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View arg0)
        {
            actual = actual > 0 ? actual - 1 : actual;
            String  country  = countires[actual];
            btn1.setText(country);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developping an app that has some quotes but I am unable to
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
I'm developing a funny quotes app for android. I have over 1000 quotes which
Developing a site that requires monthly subscriptions via PayPal. If a buyer has an
I am developing a java app, and I use resultset. I write this query,
There is this famous quote that says Procedural code gets information then makes decisions.
Im developing an app for iPhone, in wich one of the functionalities is an
iam developing one application.In that i need to get the music files from the
I'm developing an app. I want to share text and links in facebook, twitter
As we know, the magic quotes in PHP is already deprecated, this is done

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.