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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:48:27+00:00 2026-05-28T01:48:27+00:00

I am new to Android programming and I wrote an app implementing only the

  • 0

I am new to Android programming and I wrote an app implementing only the Activity.OnCreate method. I expected to go back to the previous view (which has to be the home screen due to the basic intent-filter I have) by pressing the BACK button but it does not. I managed to do that only by pressing the HOME button. (I have tested my app on multiple devices and it behaves the same.) Has everybody else went into the same problem? What is the solution? (the git repo of my app is here: https://github.com/falcondai/android_lab1)

The following is the Activity I failed to back out properly (the BACK key works fine for all other activities):

public class NameGetterActivity extends Activity 
{
    private static final String TAG = "NameGetterActivity";

    private EditText name_fld;
    private Button submit_btn;
    private Button test_btn;

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

        name_fld = (EditText)this.findViewById(R.id.editText1);
        submit_btn = (Button)this.findViewById(R.id.button1);
        test_btn = (Button)this.findViewById(R.id.button2);

        submit_btn.setOnClickListener(
                new OnClickListener() {
                    public void onClick(View v) {
                        Log.d(TAG, name_fld.getText().toString());

                        Intent i = new Intent(NameGetterActivity.this, HelloWorldActivity.class);
                        i.putExtra("name", name_fld.getText().toString());
                        startActivity(i);
                    }
                }
            );

        test_btn.setOnClickListener(
                new OnClickListener() {
                    public void onClick(View v) {
                        Log.d(TAG, "sensor activity button pressed");

                        Intent i = new Intent(NameGetterActivity.this, SensorActivity.class);
                        startActivity(i);
                    }
                }
            );
    }

}
  • 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-28T01:48:27+00:00Added an answer on May 28, 2026 at 1:48 am

    your layerout xml file use MediaController as layout root, replace it with LinearLayout

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

Sidebar

Related Questions

I am new to android programming and trying to build a map activity app.
I'm abit new to programming Android App's, however I have come across a problem,
I'm new to Android app programming and started to read a book, but it
I'm new to android programming. I get the error on extending my Activity from
I'm new to android programming (writing my first app now) and I need some
Hi I'm new to android programming, I'm trying to initiate the on click method
i'm new at Android world, and i have a doubt, is there any method
I'm new to Android programming. I've seen different phones with different screen resolutions that
I'm very new to Android programming, so this is probably something pretty basic. I
I'm really new in Android programming, so I have a simple question getting a

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.