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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:51:19+00:00 2026-05-29T21:51:19+00:00

sorry for asking dumb questions, java and Android are both new to me ;)

  • 0

sorry for asking dumb questions, java and Android are both new to me 😉

My problem: I can’t switch between two activities in a very simple app. I tried solutions described in similar topics but it didn’t work.

So this is my 1st Activity (I didn’t paste the imports):

public class OneActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

public void OnStart(){
    Button Btn = (Button)findViewById(R.id.btnNext);     
    Btn.setOnClickListener(new OnClickListener() {

        public void onClick(View Button) {

    Intent myIntent = new Intent(OneActivity.this, UserInput.class); 
    OneActivity.this.startActivity(myIntent);

        } 

});
}

}

The second Activity is very simple – it is just supposed to load a layout called userinput.xml:

public class UserInput extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.userinput);

}

}

The application part of the Manifest looks like following:

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

    <activity
        android:name=".OneActivity"
        android:label="@string/app_name" >

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


        <activity 
            android:name=".UserInput" 
            android:label="@string/app_name" />


    </activity>
</application>

When I run the app and click the button nothing happens. Where could be the problem?

// Alright, I have put the code into the onCreate() method so it now looks like following:

public class OneActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button Btn = (Button)findViewById(R.id.btnNext);     
    Btn.setOnClickListener(new OnClickListener() {

        public void onClick(View Button) {

    Intent myIntent = new Intent(OneActivity.this, UserInput.class); 
    OneActivity.this.startActivity(myIntent);

        } 

});
}

}

Now the app crashes (force close) anytime I click the Next button.

  • 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-29T21:51:21+00:00Added an answer on May 29, 2026 at 9:51 pm

    Write below code in onCreate() method:

    Button Btn = (Button)findViewById(R.id.btnNext);     
        Btn.setOnClickListener(new OnClickListener() {
    
            public void onClick(View Button) {
    
        Intent myIntent = new Intent(OneActivity.this, UserInput.class); 
        startActivity(myIntent);
    
            } 
    
    });
    

    2nd correction for android manifest file:

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
    
        <activity
            android:name=".OneActivity"
            android:label="@string/app_name" >
    
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>                     <!-- closed here -->
    
            <activity 
                android:name=".UserInput" 
                android:label="@string/app_name" />
    
    
    
    </application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry guys, I hate asking dumb questions but I have seriously been searching for
Sorry for asking this question, but I searched all Java-related questions, but I got
I'm sorry for asking noobish questions, but I am one :). I can write
Im very sorry for asking for this simple doubt.Im just started to android and
Okay, I just can't get my head around multi-threading scenarios properly. Sorry for asking
First of all sorry of asking such a dumb question, I am quite a
Sorry asking so many questions but believe me.. I tried Google first. :) When
Sorry for asking it again, there are already some questions about this keyword. But
Sorry for asking an complete n00b question, but I've tried everything I can think
Sorry for asking many questions, My doubt is: <form id =myform onSubit=return validatefields() >

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.