I have created an object that i want to be able to use in another Activity and am trying to add it to an intent. Im using this https://stackoverflow.com/a/7827593.
However when I run the program i get an error of "android.content.ActivityNotFoundException: Unable to find explicit activity class {com.deryck.helper/com.deryck.helper.SoupLog}; have you declared this activity in your AndroidManifest.xml?"
I am new to android programming so im not sure what to do with this. I had assumed that only Activites needed to be in the Manifest. If I do need to add it how do i do that or what should I be doing to pass this object around. Am I going about this entirely wrong?
My app is a few pages that gathers different information such as time and tempetures that are logged by the user. Then at the end the information is used to display when other steps need to taken and other results.
I create the Intent with
Intent i = new Intent(MainActivity.this, SoupLog.class); i.putExtra("soupObj", soup); startActivity(i);
And my object is this
package com.deryck.helper;
import java.io.Serializable;
import java.util.Calendar;
public class SoupLog implements Serializable{
private int lotNumber;
private String soupType;
private Calendar ProductionDate;
private Calendar timeStart;
private Calendar timeLethal;
private Calendar lethalTemp;
private String lethalMonInitials;
private String lethalDOInitials;
private Calendar packageStartTime;
private int firstTemp;
private int midTemp;
private int nextLastTemp;
private int lastTemp;
private Calendar packDoneTime;
private String lastMonInitials;
private String lastDOInitials;
public SoupLog(){
Calendar calendar = Calendar.getInstance();
ProductionDate = calendar;
}
public SoupLog(int lotNumber, String soupType, Calendar calendar ){
this.lotNumber = lotNumber;
this.soupType = soupType;
ProductionDate = calendar;
}
public int getLotNumber(){
return lotNumber;
}
public void setlotNumber(int lotNumber){
this.lotNumber= lotNumber;
}
public String getSoupType(){
return soupType;
}
public void setSoupType(String soupType){
this.soupType= soupType;
}
public void setProductionDate(int productionYear, int productionMonth, int ProductionDay){
ProductionDate.set(productionYear, productionMonth, ProductionDay);
}
public Calendar getProductionDate(){
return ProductionDate;
}
public void setStartTime(Calendar timeStart){
this.timeStart = timeStart;
}
public Calendar getStartTime(){
return timeStart;
}
public void setLethalTime(Calendar timeLethal ){
this.timeLethal = timeLethal;
}
public Calendar getlethalTime(){
return timeLethal;
}
public Calendar getLethalTemp() {
return lethalTemp;
}
public void setLethalTemp(Calendar lethalTemp) {
this.lethalTemp = lethalTemp;
}
public String getLethalMonInitials() {
return lethalMonInitials;
}
public void setLethalMonInitials(String lethalMonInitials) {
this.lethalMonInitials = lethalMonInitials;
}
public String getLethalDOInitials() {
return lethalDOInitials;
}
public void setLethalDOInitials(String lethalDOInitials) {
this.lethalDOInitials = lethalDOInitials;
}
public Calendar getPackageStartTime() {
return packageStartTime;
}
public void setPackageStartTime(Calendar packageStartTime) {
this.packageStartTime = packageStartTime;
}
public int getFirstTemp() {
return firstTemp;
}
public void setFirstTemp(int firstTemp) {
this.firstTemp = firstTemp;
}
public int getMidTemp() {
return midTemp;
}
public void setMidTemp(int midTemp) {
this.midTemp = midTemp;
}
public int getNextLastTemp() {
return nextLastTemp;
}
public void setNextLastTemp(int nextLastTemp) {
this.nextLastTemp = nextLastTemp;
}
public int getLastTemp() {
return lastTemp;
}
public void setLastTemp(int lastTemp) {
this.lastTemp = lastTemp;
}
public Calendar getPackDoneTime() {
return packDoneTime;
}
public void setPackDoneTime(Calendar packDoneTime) {
this.packDoneTime = packDoneTime;
}
public String getLastMonInitials() {
return lastMonInitials;
}
public void setLastMonInitials(String lastMonInitials) {
this.lastMonInitials = lastMonInitials;
}
public String getLastDOInitials() {
return lastDOInitials;
}
public void setLastDOInitials(String lastDOInitials) {
this.lastDOInitials = lastDOInitials;
}
//TODO find other times of interest
public void get2hour(){
//TODO return timePackDone+2 hours
}
}
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deryck.helper"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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="Last">
<intent-filter></intent-filter>
</activity>
<activity android:name="Lethality">
<intent-filter>
</intent-filter>
</activity>
<activity android:name="Middle">
<intent-filter></intent-filter>
</activity>
<activity android:name="Packaging">
<intent-filter></intent-filter>
</activity>
<activity android:name="Results">
<intent-filter></intent-filter>
</activity>
</application>