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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:08:29+00:00 2026-06-17T07:08:29+00:00

I am new with android this is my 1st demo app. I am trying

  • 0

I am new with android this is my 1st demo app. I am trying to navigate from one page to another. But i am not able to navigate to another page i have a button in may main xml file and on licking it is moving to an another xml nextpage. I have 2 java class : 1st MianAcitvity, nextpagejava. 2 xml : activity_main, nextpage

My code : manifest

      <activity
      android:name="com.example.androiddemo.MainActivity"
      android:label="@string/app_name" >
      <intent-filter>
          <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
     </activity>
        <activity android:name="nextpagejava" ></activity>

MainActivity.java

package com.example.androiddemo;
  import android.os.Bundle; 
   import android.app.Activity; 
   import android.content.Intent; 
   import android.drm.DrmStore.Action;
  import android.view.Menu; 
   import android.view.View; 
  import android.view.View.OnClickListener; 
    import android.widget.Button;

    public class MainActivity extends Activity implements OnClickListener {

      @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);

          Button bt = (Button)findViewById(R.id.bnt);
           bt.setOnClickListener(new View.OnClickListener() {

           @Override
           public void onClick(View v) {
                / / TODO Auto-generated method stub

             }
            }); 
            }

             @Override
            public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
              getMenuInflater().inflate(R.menu.activity_main, menu);
             return true;
            }

             @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
            switch(v.getId()){
              case R.id.bnt:
                     Intent in = new Intent(this, nextpagejava.class);
                     startActivity(in);
               break;


              }
           }
          }

acitivity_main.xml

           <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:tools="http://schemas.android.com/tools"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
            tools:context=".MainActivity" >

               <TextView 
           android:id="@+id/clicktxt"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="Click"        
         />

           <Button
           android:id="@+id/bnt"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
           android:text="Click Me"
          />

nextpage.xml

           <TextView 
             android:layout_width="match_parent"
              android:layout_height="wrap_content"
               android:text="I am i a next page..."
             />

            <Button 
              android:id="@+id/btn1"
               android:layout_width="match_parent"
                android:layout_height="wrap_content"
              android:text="Back"
             />

nextpagejava.java

         package com.example.androiddemo;

          import android.app.Activity;
          import android.os.Bundle;
          import android.view.View;
          import android.view.View.OnClickListener;
            import android.widget.Button;

           public class nextpagejava extends Activity implements OnClickListener{

       @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);

            Button bt = (Button)findViewById(R.id.btn1);
            bt.setOnClickListener(this);
            }

          @Override
           public void onClick(View v) {
            // TODO Auto-generated method stub

        }
         }

i am getting message that “Unfortunately, androiddemo has stopped” this message as a popup.

can anybody tell me why this error is coming and please tell me from where i can find line by line debug logs.

  • 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-17T07:08:31+00:00Added an answer on June 17, 2026 at 7:08 am

    Just remove this from your MainActivity.java file:

      bt.setOnClickListener(new View.OnClickListener() {   
           @Override   
           public void onClick(View v) {
                / / TODO Auto-generated method stub
             }
            }); 
    

    Instead of Write like this:

    bt.setOnClickListener(this);
    

    Also do the changes in Manifest file as below:

    <activity android:name=".nextpagejava" ></activity>
    

    Then check out . I think it should work now.

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

Sidebar

Related Questions

I am new with android this is my 1st demo app. I am trying
I am new to android programming and i am trying to develop this app
I'm trying to record audio this.recorder = new android.media.MediaRecorder(); this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC); this.recorder.setOutputFormat(android.media.MediaRecorder.OutputFormat.DEFAULT); this.recorder.setAudioEncoder(android.media.MediaRecorder.AudioEncoder.DEFAULT); this.recorder.setOutputFile(pruebaAudioRecorder.mp4); **this.recorder.prepare();**
I am very new to android and I am developing this app which allows
I'm fairly new to Android programming, so this may be a simple question, but
I'm breaking my head over this one. I'm kind of new in android development.
I am very new to Java and android. my 1st app using canvas and
I'm new to android but I've done the notepad tutorial. Now I'm trying to
i m new to this android application development i would be very much grateful
I know that eclipse can do this, can Intellij via the new Android support

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.