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

  • Home
  • SEARCH
  • 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 9163251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:24:06+00:00 2026-06-17T14:24:06+00:00

I’m developing an application. When i exit from the application, it will be opened

  • 0

I’m developing an application. When i exit from the application, it will be opened again (The first activity is called again and again). So i couldn’t able to exit from it.

In some other activities I use EXIT button and proper code to exit. Even when I click the EXIT button on those activities, it will start login activity. (login page is opened)

In my application, I use

1) Main

2) ScreenActivity

3) Login

flow: (from main->screenActivity->login)

The start page (1st activity) is posted below

public class main extends Activity {
static ConnectivityManager conMgr;

BackgroundThread backgroundThread;
TextView myText;
boolean myTextOn = true;
Cursor cursor;
String response="";
public SQLiteAdapter mySQLiteAdapter;

private  SQLiteDatabase sqLiteDatabase;
SimpleCursorAdapter cursorAdapter;

public class BackgroundThread extends Thread {

boolean running = false;



 void setRunning(boolean b){
 running = b;
}

@Override
 public void run() {
 // TODO Auto-generated method stub
 //super.run();
 while(running){
  try {
  sleep(1000);
 } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
 }
catch(Exception e)
{

}
handler.sendMessage(handler.obtainMessage());
}
}

}

Handler handler = new Handler(){

 @Override
 public void handleMessage(Message msg) {
 // TODO Auto-generated method stub
 //super.handleMessage(msg);
 if (myTextOn){
  myTextOn = false;
  myText.setVisibility(View.GONE);
 }
 else{
  myTextOn = true;
  myText.setVisibility(View.VISIBLE);
 }
}

};



  @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.thread);

   myText = (TextView)findViewById(R.id.mytext);




}



@Override
protected void onStart() {
conMgr =  (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
// TODO Auto-generated method stub
super.onStart();
if(isInternetAvailable())
{
 Toast.makeText(this, "online", Toast.LENGTH_LONG).show();

startActivity(new Intent(main.this, ScreenActivity.class));
}
else{

    startActivity(new Intent(main.this, splashscreen.class));

    Toast.makeText(this, "offline", Toast.LENGTH_LONG).show();

}


 backgroundThread = new BackgroundThread();
 backgroundThread.setRunning(true);
   backgroundThread.start();

}



private boolean isInternetAvailable() {
ConnectivityManager cm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
return true;
}
return false;

}



@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();

boolean retry = true;
backgroundThread.setRunning(false);

 while(retry){
 try {
 backgroundThread.join();
 retry = false;
} catch (InterruptedException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}
catch(Exception e)
{

}

}



}

public void onDEstroy()
{
super.onDestroy();
}
}

ScreenActivity:

public class ScreenActivity extends Activity implements AnimationListener {
private TextView animatedView3; 
//ImageView image;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash); 



   /* Animation animation1 = AnimationUtils.loadAnimation(this,  
            R.anim.anima);  
    animation1.setAnimationListener(this);  
    View animatedView1 = findViewById(R.id.aet1);  
    animatedView1.startAnimation(animation1);  


    /** set time to splash out */


    final int welcomeScreenDisplay = 9000;
    /** create a thread to show splash up to splash time */
    Thread welcomeThread = new Thread() {

        int wait = 0;

        @Override
        public void run() {
            try {
                super.run();
                /**
                 * use while to get the splash time. Use sleep() to increase
                 * the wait variable for every 100L.
                 */
                while (wait < welcomeScreenDisplay) {
                    sleep(100);
                    wait += 100;
                }
            } catch (Exception e) {
                System.out.println("EXc=" + e);
            } finally {
                /**
                 * Called after splash times up. Do some action after splash
                 * times up. Here we moved to another main activity class
                 */
                startActivity(new Intent(ScreenActivity.this,
                        login.class));

            }
        }
    };
    welcomeThread.start();

}

public void onAnimationStart(Animation animation) {  

}  

public void onAnimationEnd(Animation animation) {  
    //Toast.makeText(this, "Animation ended", Toast.LENGTH_SHORT).show();  
    if (animatedView3.getVisibility() == View.VISIBLE) {  
        animatedView3.setVisibility(View.INVISIBLE);  
    } else {  
        animatedView3.setVisibility(View.VISIBLE);  
    }  
}  

public void onAnimationRepeat(Animation animation) {  
   // Toast.makeText(this, "Animation rep", Toast.LENGTH_SHORT).show();  

}  
}

Please can anyone explain about the problem and how to solve it? I didn’t understand.

  • 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-17T14:24:07+00:00Added an answer on June 17, 2026 at 2:24 pm

    Place finish() in your loginActivity and for other Activities as well else stack will store the list of visited Activities.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string

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.