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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:10:41+00:00 2026-06-09T04:10:41+00:00

The following if my code. Please tell me what I am doing wrong? package

  • 0

The following if my code. Please tell me what I am doing wrong?

 package version.nitt;

 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.LinearLayout;
 import version.nitt.R;
 import android.util.Log;
 import android.content.Intent;

 public class versionActivity extends Activity {
private Runnable runnable;
private static final String TAG="WElcome!";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.startscreen);

    runnable= new Runnable(){
        public void run()
        {
            try
            {
                 Log.v(TAG,"Going to sleep...");  
                Thread.sleep(1000);
                 Log.v(TAG,"Waking up from sleep...");  
            }
            catch(Exception e1)
            {
            }
        }
    };
    try
    {
        Thread t=new Thread(null,runnable);
        t.start();
        final Intent i=new Intent(versionActivity.this,secondActivity.class);
        LinearLayout lin =(LinearLayout) findViewById(R.id.ll);
        lin.setOnClickListener(new OnClickListener()
        {
            public void onClick(View v)
            {
                 finish();
                 startActivity(i);
            }

        });

    }
    catch(Exception e)
    {

    }


        Button button = (Button) findViewById(R.id.cls);
        button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                finish();
                System.exit(0);
            }
      });




 }
}

I am trying to move from one activity to another if the user clicks anywhere on the screen. The Linear layout is set to clikable. The application gets loaded. But when the onClick is performed for moving on to the next activity, the app is force closed.

Log Cat:

08-05 14:46:37.028: I/Process(1883): Sending signal. PID: 1883 SIG: 9
08-05 14:46:51.479: D/dalvikvm(1915): GC_FOR_ALLOC freed 31K, 4% free 6342K/6595K, paused 64ms
08-05 14:46:51.499: I/dalvikvm-heap(1915): Grow heap (frag case) to 7.279MB for 1080016-byte allocation
08-05 14:46:51.650: D/dalvikvm(1915): GC_FOR_ALLOC freed <1K, 4% free 7396K/7687K, paused 59ms
08-05 14:46:51.819: D/dalvikvm(1915): GC_CONCURRENT freed <1K, 4% free 7396K/7687K, paused 4ms+13ms
08-05 14:46:52.019: D/dalvikvm(1915): GC_FOR_ALLOC freed <1K, 4% free 7396K/7687K, paused 57ms
08-05 14:46:52.031: I/dalvikvm-heap(1915): Grow heap (frag case) to 7.737MB for 480016-byte allocation
08-05 14:46:52.162: D/dalvikvm(1915): GC_FOR_ALLOC freed 0K, 5% free 7865K/8199K, paused 65ms
08-05 14:46:52.439: D/dalvikvm(1915): GC_CONCURRENT freed 1054K, 17% free 6813K/8199K, paused 10ms+5ms
08-05 14:46:52.840: D/dalvikvm(1915): GC_CONCURRENT freed 351K, 15% free 6973K/8199K, paused 8ms+6ms
08-05 14:46:52.840: V/WElcome!(1915): Going to sleep...
08-05 14:46:53.838: V/WElcome!(1915): Waking up from sleep...
08-05 14:47:03.398: D/AndroidRuntime(1915): Shutting down VM
08-05 14:47:03.398: W/dalvikvm(1915): threadid=1: thread exiting with uncaught exception (group=0x40014760)
08-05 14:47:03.428: E/AndroidRuntime(1915): FATAL EXCEPTION: main
08-05 14:47:03.428: E/AndroidRuntime(1915): android.content.ActivityNotFoundException: Unable to find explicit activity class {version.nitt/version.nitt.secondActivity}; have you declared this activity in your AndroidManifest.xml?
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1504)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1382)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.app.Activity.startActivityForResult(Activity.java:3131)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.app.Activity.startActivity(Activity.java:3237)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at version.nitt.versionActivity$2.onClick(versionActivity.java:46)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.view.View.performClick(View.java:3110)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.view.View$PerformClick.run(View.java:11934)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.os.Handler.handleCallback(Handler.java:587)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.os.Looper.loop(Looper.java:132)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at android.app.ActivityThread.main(ActivityThread.java:4123)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at java.lang.reflect.Method.invokeNative(Native Method)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at java.lang.reflect.Method.invoke(Method.java:491)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-05 14:47:03.428: E/AndroidRuntime(1915):     at dalvik.system.NativeStart.main(Native Method)
  • 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-09T04:10:43+00:00Added an answer on June 9, 2026 at 4:10 am
    lin.setOnClickListener(new OnClickListener()
    {
        public void onClick(View v)
        {
    
           Intent i = new Intent(versionActivity.this, secondActivity.class);     
           startActivity(i);
           finish(); //should use the finish if you need to preserve memory
                     //other wise don't use it.
        }
    
    });
    

    SECOND STEP: AndroidManifest.xml

    <activity  android:name=".secondActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />                   
         </intent-filter>
    </activity>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you please tell me what's wrong with the following code? Panel div =
Can someone please tell me what I'm doing wrong here? I get the following
could someone please tell me why the dynamic_cast in the following code (five lines
Please check following code tell me what the difference between Convert.ToInt32() and int() ,
Can someone please tell me how I can implement the following line of pseudo-code.
Please tell me what I'm doing wrong: I'm trying to create id for each
Please download the following code : http://media.pragprog.com/titles/eband3/code/Sudokuv2/src/org/example/sudoku/PuzzleView.java In the code, What initial value does
Please consider the following code: mpz_t x, n, out; mpz_init_set_ui(x, 2UL); mpz_init_set_ui(n, 7UL); mpz_init(out);
Please look at the following code: char* test ( ) { char word[20]; printf
Can anyone please explain why the following code behaving strangely: public class UserInputTest {

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.