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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:36:39+00:00 2026-06-13T08:36:39+00:00

I have an Android project. Now I need to create a second edition of

  • 0

I have an Android project. Now I need to create a second edition of that project.

What will differ:

New edition of the Project should have different content in one of the Activities.

I was thinking about creating a library project and two new projects(project1 and project2) which will use library project, but I don’t really understand how to setup this.

Should I just convert the original project into library, then create two new projects and then what? How to make project1 use activity1 and project2 use activity2 in the same place?

EDIT

What I’ve set up so far:

MainProject, a library has MainActivity.java and ChildActivity.java


AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mainproject">
    <application>
        <activity
            android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ChildActivity">
        </activity>
    </application>
</manifest>

MainActivity.java

   public class MainActivity extends Activity {

        @Override
        public void onCreate(Bundle savedInstanceState) {

            ((Button)findViewById(R.id.button1)).setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(MainActivity.this, ChildActivity.class);
                    startActivity(intent);
                }
            });
        }
}

StandAloneProject: it has only ChildActivity.java


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.standaloneproject">
    <application>
        <activity
             android:name="com.example.mainproject.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ChildActivity" >
        </activity>
    </application>
</manifest>

What I expect:

When I launch StandAloneProject and click button, I want ChildActivity from StandAloneProject(not from MainProject) to be launched.

What I get:

When I launch StandAloneProject, I see MainActivity from MainProject, click button and get:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.standaloneproject/com.example.mainproject.ChildActivity}; have you declared this activity in your AndroidManifest.xml?
  • 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-13T08:36:40+00:00Added an answer on June 13, 2026 at 8:36 am

    The problem is how you start the child activity in MainActivity.java.
    You need to ‘manually’ make sure that the correct ChildActivity is started.

    One way to do this is to explicitly set the component for the intent. The Context.getPackageName() function returns the package name of the application you are running in and you can use this to identify the ‘correct instance’ of ChildActivity you want to start. Try this in your onClick() handler in MainActivity.java:

        Intent intent = new Intent();       
        intent.setComponent(new ComponentName(getPackageName(), getPackageName() + ".ChildActivity"));
        startActivity(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android project that branched into three different applications, app-1 , app-2
I have a Android project for SDK1.5 and now I want to convert it
I created an Android project a few months ago and now have to automate
I have come across a strange error. I have an Android project that uses
I am working on android applications. In my project I need to create Listview.
I have an Android project that uses a library project (all of which I
n00b here (first Android project). I have been given a custom video codec that
Hello I am new to Android .I have been given an Android project to
i have try to create new ndk project in eclipse i have done all
I have dug out an old android project that I was working on a

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.