Leon
Leon

Reputation: 339

Switch activities from one package to another?

My main package is called com.android.cats, and I created a another package (in the same app) named com.android.dog. In package com.android.cats I created an Activity called Meow.java, and in package com.android.dog I created an Activity called Ruff.java. My question is: how can I switch the activity from Meow.java to Ruff.java?

Upvotes: 1

Views: 464

Answers (1)

Marvin Pinto
Marvin Pinto

Reputation: 30990

Declare your activities in AndroidManifest.xml similar to the following:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="com.android"
...
>
...
<activity android:name=".cats.Meow" />
<activity android:name=".dogs.Ruff" />
...

Then in your application code, launch your intents as you usually would, of course using the full package name instead (i.e. com.android.dogs.Ruff)

Upvotes: 1

Related Questions