I’d like to ask how to reference other classes from my other package in Android?
I have my main package. Under that it has several subpackages.
How do I reference those classes under subpackage into my main class in the main package?
What I’m doing is, in the main class, I’m calling the class in the subpackage via Intent.
Here’s what I’ve tried so far to no avail:
case 0:
Intent acorn = new Intent( "com.fps.iHealthFirst.vegetables.AcornSquash.class" );
//Intent acorn = new Intent( Nutritional_List.this, AcornSquash.class );
startActivity( acorn );
break;
I’m having a hard time doing this. Thanks for your help.
BTW, this is the logcat:
10-22 23:13:03.585: E/AndroidRuntime(395): FATAL EXCEPTION: main
10-22 23:13:03.585: E/AndroidRuntime(395): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.fps.iHealthFirst/com.fps.iHealthFirst.vegetables.AcornSquash}; have you declared this activity in your AndroidManifest.xml?
Also, I’ve edited this in the manifest file:
<activity android:exported="false"
android:name=".vegetables.AcornSquashAcornSquash"
android:label="@string/inutrition" >
<intent-filter >
<action android:name="com.fps.iHealthFirst.vegetables.ACORNSQUASH" />
</intent-filter>
</activity>
Here is what you should do:
UPDATE:
You have to declare all your activities in your Manifest.xml. Keep it simple:
Finally, make sure your folder structure is in line with your packages paths, i.e. your file
AcornSquash.javahas to be in thesrc/com/fps/iHealthFirst/vegetables/folder.