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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:53:58+00:00 2026-06-15T12:53:58+00:00

The title just about explains my entire problem. I have a simple news app

  • 0

The title just about explains my entire problem. I have a simple news app – scroll up and down to look at article headlines, then click one to go to the ArticleActvity (ie read the article).

When the user swipes left or right, it loads the next or previous article. But – my code apparently just loads a new article activity on top of the other, because my back button, when clicked multiple times, will close the article activity, then close another, then close another….etc etc. until you finally get back to the list of articles.

As an Android noob, here’s my code to 1) detect a horizontal swipe, and 2) reload (attempt) the same activity with a new article.

Versions:

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15"/>

My code in ArticleActivty.java:

SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener()
{

     @Override
     public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
     {
         if(distanceX < -60)
         {
             //still need to hide article and show rotator graphic
             Intent myIntent = new Intent(getBaseContext(), ArticleActivity.class);
             myIntent.putExtra("id", String.valueOf(articlesDataSource.getNextOrPrevArticleId(article.id, true)));
             overridePendingTransition(0, 0);
             myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

             finish();

             overridePendingTransition(0, 0);
             startActivity(myIntent);
         }
         else if(distanceX > 60)
         {
             //still need to hide article and show rotator graphic
             Intent myIntent = new Intent(getBaseContext(), ArticleActivity.class);
             myIntent.putExtra("id", String.valueOf(articlesDataSource.getNextOrPrevArticleId(article.id, false)));
             overridePendingTransition(0, 0);
             myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

             finish();

             overridePendingTransition(0, 0);
             startActivity(myIntent);
         }
         return super.onScroll(e1, e2, distanceX, distanceY);
     }
  • 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-15T12:53:59+00:00Added an answer on June 15, 2026 at 12:53 pm

    add android:launchMode="singleInstance"

    in the ArticleActivity's tag of your manifest file

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

Sidebar

Related Questions

i have a problem just as title, and the http-status is 302 Moved Temporarily.
The title just about says it all. I have a complex EF4 entity object
I've got a rails app with a posts scaffold that has just a title
I just want what my title says.I have already read all the previous similar
The title explains it well. I have set up Notepad++ to open the Python
Sorry about the confusing title, I had a hard time describing the problem. I
Just a simple question, just as the title states. I just want to know
As the title states, I have a problem with high page file activity. I
When compiling my app with LLVM, just about the only errors I get are:
I have been reading an article about C++ interfaces ( http://accu.org/index.php/journals/233 ) and 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.