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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:54:20+00:00 2026-06-18T23:54:20+00:00

I am trying make an app that uses the accelerometer but when I run

  • 0

I am trying make an app that uses the accelerometer but when I run my app it says unfortunately app has stopped. I had other code but i deleted it because i thought it was messing up the code but it wasn’t.

Here is the code

`

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent one = new Intent(getApplicationContext(), act.class);
    startActivity(one);


}


        }
          class act extends Activity implements SensorEventListener {
              Intent one = getIntent();
              private SensorManager sensorManager;
                private Sensor accelerometer;
             float x,y,z;   
             @Override
             public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);

                    setContentView(R.layout.activity2);
                    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
                    accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
             }

             protected void onResume() {
                    super.onResume();
                    sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
                }
                protected void onPause() {
                    super.onPause();
                    sensorManager.unregisterListener(this);
                }


           @Override
           public void onAccuracyChanged(Sensor accelerometer, int accuracy) {
           }
             public void onSensorChanged(SensorEvent event) {

                    if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {

                        x = event.values[0];
                        y = event.values[1];
                        z = event.values[2];

                    }
                        }

             }`

Both of the classes are in the same file

LogCat:

02-19 14:32:24.490: E/AndroidRuntime(7916): FATAL EXCEPTION: main
02-19 14:32:24.490: E/AndroidRuntime(7916): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.a3/com.example.a3.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.a3/com.example.a3.act}; have you declared this activity in your AndroidManifest.xml?
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.os.Looper.loop(Looper.java:137)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread.main(ActivityThread.java:5039)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at java.lang.reflect.Method.invokeNative(Native Method)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at java.lang.reflect.Method.invoke(Method.java:511)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at dalvik.system.NativeStart.main(Native Method)
02-19 14:32:24.490: E/AndroidRuntime(7916): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.a3/com.example.a3.act}; have you declared this activity in your AndroidManifest.xml?
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Activity.startActivityForResult(Activity.java:3370)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Activity.startActivityForResult(Activity.java:3331)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Activity.startActivity(Activity.java:3566)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Activity.startActivity(Activity.java:3534)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at com.example.a3.MainActivity.onCreate(MainActivity.java:32)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Activity.performCreate(Activity.java:5104)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-19 14:32:24.490: E/AndroidRuntime(7916):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-19 14:32:24.490: E/AndroidRuntime(7916):     ... 11 more
  • 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-18T23:54:22+00:00Added an answer on June 18, 2026 at 11:54 pm

    Chances are you did not declare the act activity correctly in the manifest. Run android lint on your project, and see if it tells you what’s happening. Or in Eclipse look at your manifest file in all the manifest viewer tabs (not just code) and see if it gives you red warnings.

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

Sidebar

Related Questions

I'm trying to make a landscape app that uses navigation controller, but I can't
I am trying to make a web app in Dashcode that uses a range
I'm trying to make an app that uses Google maps API mapviews and my
I'm trying to make an app that uses the list of songs that a
I'm trying to make a app that uses a photobrowser Decided to go with
I am trying to make an iPhone app that uses OpenCV plus another C++
I am trying to make a small app that uses a multiple hierarchy of
I'm trying to develop an app that uses opengl on android, and ideally make
I am trying to make an app that uses a radial dial. As an
I'm trying to make a small app that uses Backbone to render views for

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.