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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:01:07+00:00 2026-05-27T20:01:07+00:00

My start activity is a LoginView . If the login was correct i call

  • 0

My start activity is a LoginView.
If the login was correct i call startActivity(new Intent(LoginView.this, MainView.class)); and finish().

So my App switch to the MainView and if i press the back button the app goes to the backgroud.

My Problem:

If i resume the app (long press the home key) i always come back to the LoginView and not to the Mainview

MainView:

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainlayout);
}

Please help

  • 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-05-27T20:01:08+00:00Added an answer on May 27, 2026 at 8:01 pm
      login.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View view)
            {
                String name=username.getText().toString();
                SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                SharedPreferences.Editor editor = settings.edit();
                editor.putString("username", name);
                if(name.equals("xxx"))
                    {
    
                        Intent intent=new Intent(currentactivity.this,nextactivity.class);
                        intent.putExtras(bundle);
                        startActivityForResult(intent,0);
                    }   
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a broadcast receiver to start activity onReceive like this: public class BroadcastReceiver1
I have main activity which call other object, for example GPS class. This GPS
this button is shown on my start activity. After pressing it a new activity
In an given Android activity, I would like to start a new activity for
Can someone tell if why when starting an activity with startActivity(intent) , calling getParent()
01-26 20:45:50.841: E/AndroidRuntime(327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demo.app/com.demo.app.Sencha_demoActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0 01-26
we start activity and do not calling finish() on existing activity it keeps existing
I'm looking for the best way to start an intent from a class that
I have an error when i use intent to start activity when i choose
What causing this Android RuntimeException? 02-01 15:13:41.316: ERROR/AndroidRuntime(3989): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cccc.xxxx/com.cccc.xxxx.ActivityMyScreen}:

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.