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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:25:27+00:00 2026-05-23T19:25:27+00:00

I just started development for Android, and I am stuck with this code: public

  • 0

I just started development for Android, and I am stuck with this code:

public class Home extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);
        Button buttonFoo = (Button)findViewById(R.id.buttonFoo);
        buttonFoo.setOnClickListener(openFoo);
    }

    public OnClickListener openFoo = new OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(Home.this, Foo.class);
            startActivity(intent);
        }
    };
}

And here is the code of activity Foo:

public class Foo extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //populateWithLatest();
    }
}

And the error log:

07-18 19:53:35.043: ERROR/AndroidRuntime(4656): FATAL EXCEPTION: main
07-18 19:53:35.043: ERROR/AndroidRuntime(4656): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.github.progval.openquote/com.github.progval.openquote.sites.FooActivity}; have you declared this activity in your AndroidManifest.xml?
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.app.Activity.startActivityForResult(Activity.java:2827)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.app.Activity.startActivity(Activity.java:2933)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at com.github.progval.openquote.Home$1.onClick(Home.java:34)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.view.View.performClick(View.java:2501)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.view.View$PerformClick.run(View.java:9107)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.os.Handler.handleCallback(Handler.java:587)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.os.Looper.loop(Looper.java:130)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at android.app.ActivityThread.main(ActivityThread.java:3835)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at java.lang.reflect.Method.invokeNative(Native Method)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at java.lang.reflect.Method.invoke(Method.java:507)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
07-18 19:53:35.043: ERROR/AndroidRuntime(4656):     at dalvik.system.NativeStart.main(Native Method)

Unless I comment the line startActivity(intent);, the app force closes when I press the Foo 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-23T19:25:27+00:00Added an answer on May 23, 2026 at 7:25 pm
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <activity android:name=".Home"
                  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=".Foo"></activity>
    

    This is my favorite part:

    07-18 19:53:35.043: ERROR/AndroidRuntime(4656): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.github.progval.openquote/com.github.progval.openquote.sites.VdmActivity}; have you declared this activity in your AndroidManifest.xml?

    I don’t know if this is the best way to implement a button, but here’s how I do it:

    findViewById(R.id.buttonFoo).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent i = new Intent(v.getContext(), Foo.class);
            startActivity(i);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started checking out android development, but having problems already. The activity shuts down
Just getting started with Android development and Java. So, here's the code I'm working
I'm just starting to learn Android development and writing my first app. I started
I've just started my first development job for a reasonably sized company that has
I've just set up my first Android development environment consisting of Eclipse 3.5 Mac
I'm familiar with C++ but never used Java. I've just started learning Android development.
I've just started learning Android development and as a little project, I'm building a
I'm just getting started with Android app development on a Mac, and I keep
I have just started with java development using Eclipse, when I was debugging this
I just started to learn Android development. My previous experience is majorly .NET framework

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.