Realm in android - android

I want to use two class for database.
here is my source.
public class UserInfo extends RealmObject {
private String user_email;
private String nick_name;
private String expected_date;
private boolean initial_autho;
private int resultDay;
public int getResultDay() {
return resultDay;
}
public void setResultDay(int resultDay) {
this.resultDay = resultDay;
}
public String getUser_email() {
return user_email;
}
public void setUser_email(String user_email) {
this.user_email = user_email;
}
public String getNick_name() {
return nick_name;
}
public void setNick_name(String nick_name) {
this.nick_name = nick_name;
}
public String getExpected_date() {
return expected_date;
}
public void setExpected_date(String expected_date) {
this.expected_date = expected_date;
}
public boolean getInitial_autho() {
return initial_autho;
}
public void setInitial_autho(boolean initial_autho) {
this.initial_autho = initial_autho;
}
}
public class Calendar extends Realmobject {
private long millis;
private String note; // 노트
private String mail; // who
private int image; // image resource
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public long getTime() {
return millis;
}
public String getNote() {
return note;
}
public int getImage() {
return image;
}
public void setDate(long time) {
this.millis = time;
}
public void setNote(String note) {
this.note = note;
}
public void setImage(int image) {
this.image = image;
}
}
How do I use these things in Activity?
I don't know exactly and I much appreciate if you guys could tell about that more specifically as much as you can.

Related

How to get JSON Array inside of a JSON Object and iterate

I am trying to communicate with an API using Retrofit in Android Studios but do not know how to get the JSON array within a JSON object.
JSON:
{
"result":{
"status":{
"msg":"success",
"code":200,
"action":2,
"execution_time":"0.505"
},
"page":"1",
"page_size":"40",
"q":"iphone",
"sort":"default",
"tmall":false,
"free_shiping":false,
"total_results":1924963,
"ip":"13.228.169.5",
"item":[
{
"num_iid":619354061232,
"pic":"https://img.alicdn.com/bao/uploaded/i4/2150908574/O1CN01O3Akm82DCwTChbTXg_!!2150908574.jpg",
"title":"Apple/苹果 iPhone XR iphone xs max手机双卡国行原装4G xr苹果x",
"price":"6000",
"promotion_price":"2009",
"sales":1973,
"loc":"广东 深圳",
"seller_id":2150908574,
"seller_nick":"实惠馆超市",
"shop_title":"新魔方数码",
"user_type":0,
"detail_url":"https://item.taobao.com/item.htm?id=619354061232",
"delivery_fee":"0.00"
}
"item":[...]
Method:
private void taobaoSearch(){
TaobaoInterface retrofitInterface = RetrofitInstance.getRetrofitInstanceTaobao().create(TaobaoInterface.class);
Call<TaobaoModel> listCall = retrofitInterface.getTaobao("item_search", "40","default", "iphone","taobao-api.p.rapidapi.com", "//apikey hidden");
listCall.enqueue(new Callback<TaobaoModel>() {
#Override
public void onResponse(Call<TaobaoModel> call, Response<TaobaoModel> response) {
//not sure what to do here
}
#Override
public void onFailure(Call<TaobaoModel> call, Throwable t) {
System.out.println("FAILED");
System.out.println(call);
t.printStackTrace();
}
});
}
TaobaoModel:
public class TaobaoModel {
#SerializedName("result")
private Result result;
public Result getResult() {
return result;
}
public void setResult(Result result) {
this.result = result;
}
}
Result:
public class Result {
#SerializedName("status")
private Status status;
#SerializedName("q")
private String q;
#SerializedName("page")
private String page;
#SerializedName("page_size")
private String page_size;
#SerializedName("total_results")
private int total_results;
#SerializedName("tmall")
private String tmall;
#SerializedName("sort")
private String sort;
#SerializedName("free_shiping")
private String free_shiping;
#SerializedName("ip")
private String ip;
#SerializedName("item")
private ArrayList<TaobaoItems> item;
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getQ() {
return q;
}
public void setQ(String q) {
this.q = q;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getPage_size() {
return page_size;
}
public void setPage_size(String page_size) {
this.page_size = page_size;
}
public int getTotal_results() {
return total_results;
}
public void setTotal_results(int total_results) {
this.total_results = total_results;
}
public String getTmall() {
return tmall;
}
public void setTmall(String tmall) {
this.tmall = tmall;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getFree_shiping() {
return free_shiping;
}
public void setFree_shiping(String free_shiping) {
this.free_shiping = free_shiping;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public ArrayList<TaobaoItems> getItem() {
return item;
}
public void setItem(ArrayList<TaobaoItems> item) {
this.item = item;
}
}
TaobaoItems
public class TaobaoItems {
#SerializedName("num_iid")
private long num_iid;
#SerializedName("pic")
private String pic;
#SerializedName("title")
private String title;
#SerializedName("price")
private String price;
#SerializedName("promotion_price")
private String promotion_price;
#SerializedName("sales")
private int sales;
#SerializedName("loc")
private String loc;
#SerializedName("seller_id")
private long seller_id;
#SerializedName("seller_nick")
private String seller_nick;
#SerializedName("shop_title")
private String shop_title;
#SerializedName("user_type")
private int user_type;
#SerializedName("detail_url")
private String detail_url;
#SerializedName("delivery_fee")
private String delivery_fee;
public TaobaoItems(String title, String price, String pic, String detail_url) {
this.pic = pic;
this.title = title;
this.price = price;
this.detail_url = detail_url;
}
public long getNum_iid() {
return num_iid;
}
public void setNum_iid(long num_iid) {
this.num_iid = num_iid;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getPromotion_price() {
return promotion_price;
}
public void setPromotion_price(String promotion_price) {
this.promotion_price = promotion_price;
}
public int getSales() {
return sales;
}
public void setSales(int sales) {
this.sales = sales;
}
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
public long getSeller_id() {
return seller_id;
}
public void setSeller_id(long seller_id) {
this.seller_id = seller_id;
}
public String getSeller_nick() {
return seller_nick;
}
public void setSeller_nick(String seller_nick) {
this.seller_nick = seller_nick;
}
public String getShop_title() {
return shop_title;
}
public void setShop_title(String shop_title) {
this.shop_title = shop_title;
}
public int getUser_type() {
return user_type;
}
public void setUser_type(int user_type) {
this.user_type = user_type;
}
public String getDetail_url() {
return detail_url;
}
public void setDetail_url(String detail_url) {
this.detail_url = detail_url;
}
public String getDelivery_fee() {
return delivery_fee;
}
public void setDelivery_fee(String delivery_fee) {
this.delivery_fee = delivery_fee;
}
}
Status:
public class Status {
#SerializedName("msg")
private String msg;
#SerializedName("code")
private int code;
#SerializedName("action")
private int action;
#SerializedName("execution_time")
private String execution_time;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public int getAction() {
return action;
}
public void setAction(int action) {
this.action = action;
}
public String getExecution_time() {
return execution_time;
}
public void setExecution_time(String execution_time) {
this.execution_time = execution_time;
}
}
My intention is to get the JSON Array item and display title,price,pic,detail_url from it. I found out how to display it one at a time so far, but couldn't find how to iterate the JSON object so that I can display the data in a listview. Please help, I am new to this and I've been stuck for quite awhile now. If you want to see my interface, retrofit instance etc just let me know.
private void taobaoSearch(){
TaobaoInterface retrofitInterface = RetrofitInstance.getRetrofitInstanceTaobao().create(TaobaoInterface.class);
Call<TaobaoModel> listCall = retrofitInterface.getTaobao("item_search", "40","default", "iphone","taobao-api.p.rapidapi.com", "//apikey hidden");
listCall.enqueue(new Callback<TaobaoModel>() {
#Override
public void onResponse(Call<TaobaoModel> call, Response<TaobaoModel> response) {
List<Result> retro=response.body().getitems();
generateDataList(retro);
}
#Override
public void onFailure(Call<TaobaoModel> call, Throwable t) {
System.out.println("FAILED");
System.out.println(call);
t.printStackTrace();
}
});
}
/*Method to generate List of data using RecyclerView with custom adapter*/
private void generateDataList(List<Result> dataList) {
recyclerView = findViewById(R.id.customRecycler);
adapter = new CustomAdapter(this,dataList);
recyclerView.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
}

Fetching json object from JSON string

I am new to Android and I am developing app which has server side functionality. I am getting response in JSON format.
My response is shown as this image.
I know how to parse json using Volley but I don't know hot to parse using GSON. Previous code of my app was written by some one else. Now I have to complete this code. but I do not know how he getting data from JSON string.
I need JSON arrays in different activity. Array response:
image
Here is some snaps of my code.
Code for adapter for activity one
topicListAdapter = new TopicListAdapter(TopicActivity.this,
myCourseListMain. getCourseArrayList().get(Integer.parseInt(course_position)).
getTopicListMain().getTopicDetailsArrayList(), flag);
listAlltopics.setAdapter(topicListAdapter);
in which I got list of topics
here is code for second activity list adapter
lessionListAdapter = new LessionListAdapter(LessionActivity.this,
myCourseListMain. getCourseArrayList(). get(Integer.parseInt(course_position)).
getTopicListMain().getTopicDetailsArrayList().get(Integer.parseInt(topic_position)).getLessionArrayList(), flag);
by this code i got array of lession in second activity
Now I want sublession array in third activity but I don't know how to get it.
Here is what I tried
lessionListAdapter = new DummyAdapter(DummyTopicList.this,
myCourseListMain . getCourseArrayList(). get(Integer.parseInt(course_position)).
getTopicListMain() . getTopicDetailsArrayList() .get(Integer.parseInt(topic_position)).
getLessionLIstMain() .getLessionLIstDetailArrayList().get(Integer.parseInt(lession_position)). , flag);
listAlllessions.setAdapter(lessionListAdapter);
Here are some other classes which helpful to you for understand
public class MyCourseListMain {
#SerializedName("data")
private ArrayList<Course> courseArrayList;
public ArrayList<Course> getCourseArrayList() {
return courseArrayList;
}
public void setCourseArrayList(ArrayList<Course> courseArrayList) {
this.courseArrayList = courseArrayList;
}
}
class for course
public class Course {
#SerializedName("img")
private String img;
#SerializedName("title")
private String title;
#SerializedName("institute_id")
private String institute_id;
#SerializedName("institute_name")
private String institute_name;
#SerializedName("expired")
private String expired;
#SerializedName("status")
private String status;
#SerializedName("subscribe_box")
private String subscribe_box;
#SerializedName("expire_on")
private String expire_on;
#SerializedName("item_id")
private String item_id;
#SerializedName("rated")
private String rated;
private TopicListMain topicListMain;
public String getRated() {
return rated;
}
public void setRated(String rated) {
this.rated = rated;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getInstitute_id() {
return institute_id;
}
public void setInstitute_id(String institute_id) {
this.institute_id = institute_id;
}
public String getInstitute_name() {
return institute_name;
}
public void setInstitute_name(String institute_name) {
this.institute_name = institute_name;
}
public String getExpired() {
return expired;
}
public void setExpired(String expired) {
this.expired = expired;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSubscribe_box() {
return subscribe_box;
}
public void setSubscribe_box(String subscribe_box) {
this.subscribe_box = subscribe_box;
}
public String getExpire_on() {
return expire_on;
}
public void setExpire_on(String expire_on) {
this.expire_on = expire_on;
}
public String getItem_id() {
return item_id;
}
public void setItem_id(String item_id) {
this.item_id = item_id;
}
public TopicListMain getTopicListMain() {
return topicListMain;
}
public void setTopicListMain(TopicListMain topicListMain) {
this.topicListMain = topicListMain; } }
class for topiclist_main
public class TopicListMain {
#SerializedName("data")
private ArrayList<TopicDetails> topicDetailsArrayList;
public ArrayList<TopicDetails> getTopicDetailsArrayList() {
return topicDetailsArrayList;
}
public void setTopicDetailsArrayList(ArrayList<TopicDetails> topicDetailsArrayList) {
this.topicDetailsArrayList = topicDetailsArrayList; }}
class for topic details
public class TopicDetails
{
#SerializedName("topic_id")
private String topic_id;
#SerializedName("title")
private String title;
#SerializedName("locked")
private String locked;
#SerializedName("lessons")
private ArrayList<Lession> lessionArrayList;
private LessionLIstMain lessionLIstMain;
public LessionLIstMain getLessionLIstMain() {
return lessionLIstMain;
}
public void setLessionLIstMain(LessionLIstMain lessionLIstMain) {
this.lessionLIstMain = lessionLIstMain;
}
public String getTopic_id() {
return topic_id;
}
public void setTopic_id(String topic_id) {
this.topic_id = topic_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLocked() {
return locked;
}
public void setLocked(String locked) {
this.locked = locked;
}
public ArrayList<Lession> getLessionArrayList() {
return lessionArrayList;
}
public void setLessionArrayList(ArrayList<Lession> lessionArrayList) {
this.lessionArrayList = lessionArrayList; }}
https://github.com/google/gson
Make your object have same construct with your data which you got.And
YourObject val = new Gson().fromJson(new String(YourString.getBytes("ISO-8859-1"),
"UTF-8"), YourObject.class);
finally i got my solution by below code.
lessionListAdapter = new DummyAdapter(DummyTopicList.this,
myCourseListMain . getCourseArrayList(). get(Integer.parseInt(course_position)).
getTopicListMain() . getTopicDetailsArrayList() .get(Integer.parseInt(topic_position)).
getLessionArrayList().get(Integer.parseInt((lession_position))).getLessionLIstDetailArrayList() , flag);
listAlllessions.setAdapter(lessionListAdapter);
i also made some few classes to handle json array.
public class SubLessionDetail {
#SerializedName("lesson_id")
private String lession_id;
#SerializedName("title")
private String title;
#SerializedName("locked")
private String locked;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLocked() {
return locked;
}
public void setLocked(String locked) {
this.locked = locked;
}
public String getLession_id() {
return lession_id;
}
public void setLession_id(String lession_id) {
this.lession_id = lession_id;
}
}

Clear a Model class

I have a model class "JobPostBean" which I'm initiating in another model class and adding data using the second model class. I would like to clear any data which gets saved in the "JobPostBean" class. Is there any way to clear it either in "JobPostBean" class or in the second model class where its initialised? I would prefer to clear it using a single method rather than setting every item in the "JobPostBean" class to null.
public class BidNextJobDataModel {
private static BidNextJobDataModel ourInstance = new BidNextJobDataModel();
public static BidNextJobDataModel getInstance() {
return ourInstance;
}
private BidNextJobDataModel() {
}
public UserBean userBean;
// Here I initialised the class
public JobPostBean jobPostBean = new JobPostBean();
public ArrayList<FilterModel> filterModelArrayList = new ArrayList<FilterModel>();
public ArrayList<FilterModel> notificationModelArrayList = new ArrayList<FilterModel>();
public ArrayList<FilterModel> chooseCategoryArrayList = new ArrayList<FilterModel>();
public ArrayList<JobsBean> jobsBeanArrayList = new ArrayList<JobsBean>();
}
public class JobPostBean {
private String jobtype="";
private String days="";
private String hour="";
private String title="";
private String category="";
private String categorytxt="";
private String description="";
private String price="";
private String duration="";
private String is_certified="";
private String is_insure="";
private String is_experience="";
private String address="";
private String name="";
private String image="";
private String date="";
private String pricetype="";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getJobtype() {
return jobtype;
}
public void setJobtype(String jobtype) {
this.jobtype = jobtype;
}
public String getDays() {
return days;
}
public void setDays(String days) {
this.days = days;
}
public String getHour() {
return hour;
}
public void setHour(String hour) {
this.hour = hour;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getCategorytxt() {
return categorytxt;
}
public void setCategorytxt(String categorytxt) {
this.categorytxt = categorytxt;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getIs_certified() {
return is_certified;
}
public void setIs_certified(String is_certified) {
this.is_certified = is_certified;
}
public String getIs_insure() {
return is_insure;
}
public void setIs_insure(String is_insure) {
this.is_insure = is_insure;
}
public String getIs_experience() {
return is_experience;
}
public void setIs_experience(String is_experience) {
this.is_experience = is_experience;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPricetype() {
return pricetype;
}
public void setPricetype(String pricetype) {
this.pricetype = pricetype;
}
}
public ArrayList<JobPostBean > al_JobPostBean = new ArrayList<JobPostBean >(); // Declare as global
At first Hold Data in ArrayList .If you want delete all data then You can Clear ArrayList
al_JobPostBean.clear();
The clear() method removes all the elements of ArrayList .

RoboSpice-Retrofit POJO

I have a JSON like this:
{"meta": {...}, "objects": [{...}, {...}]}
But the problem is how to construct the POJO class. From the samples there is only one example with simple JSON.
I tried with something like this:
class Test {
public ArrayList<String> meta;
public static class Object {
public String testField;
}
public static class Objects extends ArrayList<Object>{}
}
And in the RetrofitRequest class I use Test.Objects.class
Any help will be appreciated!
I've fixed it with creating classes for meta and object where objects are in ArrayList<Object>
Thanks!
These are the POJO class to hold and parse the json
1)Meta.java
public class Meta {
private int limit;
private String next;
private int offset;
private String previous;
private int total_count;
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getNext() {
return next;
}
public void setNext(String next) {
this.next = next;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public String getPrevious() {
return previous;
}
public void setPrevious(String previous) {
this.previous = previous;
}
public int getTotal_count() {
return total_count;
}
public void setTotal_count(int total_count) {
this.total_count = total_count;
}
}
2)Objects.java
public class Objects {
private String description;
private int downloads;
private int family_filter;
private int id;
private String image_url;
private int rating;
private String resource_uri;
private int size;
private String tags;
private String title;
private String uploaded_date;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public int getFamily_filter() {
return family_filter;
}
public void setFamily_filter(int family_filter) {
this.family_filter = family_filter;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImage_url() {
return image_url;
}
public void setImage_url(String image_url) {
this.image_url = image_url;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
public String getResource_uri() {
return resource_uri;
}
public void setResource_uri(String resource_uri) {
this.resource_uri = resource_uri;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUploaded_date() {
return uploaded_date;
}
public void setUploaded_date(String uploaded_date) {
this.uploaded_date = uploaded_date;
}
}
3) Finally your Test.java
public class Test {
private Meta meta;
private List<Objects> objects;
public Meta getMeta() {
return meta;
}
public void setMeta(Meta meta) {
this.meta = meta;
}
public List<Objects> getObjects() {
return objects;
}
public void setObjects(List<Objects> objects) {
this.objects = objects;
}
}
Try like this.
This is complete POJO class which will hold the parsed json.

How to access Serializable object in android

I am using Serializable interface to send user defined data from one activity to another.
Here is my code :
TasksheetData[] alltasks = new TasksheetData();
Intent in=new Intent(TaskSheetList.this, TaskDetails.class);
in.putExtra("TaskSheetData", alltasks);
and in other activity I am accessing this object like :
TasksheetData tData = (TasksheetData) getIntent().getSerializableExtra("TaskSheetData");
and here is my TasksheetData class
#SuppressWarnings("serial")
public class TasksheetData implements Serializable {
private int TaskID;
private int AttendantID;
private String AttendentName;
private String ReservationID;
private String ResStatusCode;
private int InspectionStartedById;
private String HKStatusCode;
private int FOStatusID;
private String FOStatusCode;
private int JobStatusID;
private String JobStatusCode;
private int LocationID;
private String LocationName;
private int RoomTypeID;
private String RoomType;
private int SectionID;
private String GuestID;
private String GuestName;
private String VIPCode;
private String Pax;
private String ArrivalTime;
private String CheckInTime;
private String CheckOutTime;
private String QueueSince;
private Trace[] arrTraces;
private String Specials;
private String ReservationComments;
private String SupervisorComments;
private String HKNotes;
private String TaskSheetName;
private int StandardCleaningTime;
private int AttendantPriority;
private String SupervisorPriority;
private String TaskStartTime;
private String TaskEndTime;
private String TasksheetInstruction;
private String localJobStatusCode;
private Boolean isSynch;
private String credit;
private String RemainingTimeSec;
private String TaskTypeId;
private String AttendantCLTypeId, SupervisorCLTypeId;
private String TritonLocationID;
private String PendingTritonJob;
private Boolean isDiscrepancy, InspectionStatus, IsTaskInspected;
public int getTaskID() {
return TaskID;
}
public void setTaskID(int taskID) {
TaskID = taskID;
}
public int getAttendantID() {
return AttendantID;
}
public void setAttendantID(int attendantID) {
AttendantID = attendantID;
}
public String getAttendentName() {
return AttendentName;
}
public void setAttendentName(String attendentName) {
AttendentName = attendentName;
}
public String getReservationID() {
return ReservationID;
}
public void setReservationID(String reservationID) {
ReservationID = reservationID;
}
public String getResStatusCode() {
return ResStatusCode;
}
public void setResStatusCode(String resStatusCode) {
ResStatusCode = resStatusCode;
}
public int getInspectionStartedById() {
return InspectionStartedById;
}
public void setInspectionStartedById(int inspectionStartedById) {
InspectionStartedById = inspectionStartedById;
}
public String getHKStatusCode() {
return HKStatusCode;
}
public void setHKStatusCode(String hKStatusCode) {
HKStatusCode = hKStatusCode;
}
public int getFOStatusID() {
return FOStatusID;
}
public void setFOStatusID(int fOStatusID) {
FOStatusID = fOStatusID;
}
public String getFOStatusCode() {
return FOStatusCode;
}
public void setFOStatusCode(String fOStatusCode) {
FOStatusCode = fOStatusCode;
}
public int getJobStatusID() {
return JobStatusID;
}
public void setJobStatusID(int jobStatusID) {
JobStatusID = jobStatusID;
}
public String getJobStatusCode() {
return JobStatusCode;
}
public void setJobStatusCode(String jobStatusCode) {
JobStatusCode = jobStatusCode;
}
public int getLocationID() {
return LocationID;
}
public void setLocationID(int locationID) {
LocationID = locationID;
}
public String getLocationName() {
return LocationName;
}
public void setLocationName(String locationName) {
LocationName = locationName;
}
public int getRoomTypeID() {
return RoomTypeID;
}
public void setRoomTypeID(int roomTypeID) {
RoomTypeID = roomTypeID;
}
public String getRoomType() {
return RoomType;
}
public void setRoomType(String roomType) {
RoomType = roomType;
}
public int getSectionID() {
return SectionID;
}
public void setSectionID(int sectionID) {
SectionID = sectionID;
}
public String getGuestID() {
return GuestID;
}
public void setGuestID(String guestID) {
GuestID = guestID;
}
public String getGuestName() {
return GuestName;
}
public void setGuestName(String guestName) {
GuestName = guestName;
}
public String getVIPCode() {
return VIPCode;
}
public void setVIPCode(String vIPCode) {
VIPCode = vIPCode;
}
public String getPax() {
return Pax;
}
public void setPax(String pax) {
Pax = pax;
}
public String getArrivalTime() {
return ArrivalTime;
}
public void setArrivalTime(String arrivalTime) {
ArrivalTime = arrivalTime;
}
public String getCheckInTime() {
return CheckInTime;
}
public void setCheckInTime(String checkInTime) {
CheckInTime = checkInTime;
}
public String getCheckOutTime() {
return CheckOutTime;
}
public void setCheckOutTime(String checkOutTime) {
CheckOutTime = checkOutTime;
}
public String getQueueSince() {
return QueueSince;
}
public void setQueueSince(String queueSince) {
QueueSince = queueSince;
}
public Trace[] getArrTraces() {
return arrTraces;
}
public void setArrTraces(Trace[] arrTraces) {
this.arrTraces = arrTraces;
}
public String getSpecials() {
return Specials;
}
public void setSpecials(String specials) {
Specials = specials;
}
public String getReservationComments() {
return ReservationComments;
}
public void setReservationComments(String reservationComments) {
ReservationComments = reservationComments;
}
public String getSupervisorComments() {
return SupervisorComments;
}
public void setSupervisorComments(String supervisorComments) {
SupervisorComments = supervisorComments;
}
public String getHKNotes() {
return HKNotes;
}
public void setHKNotes(String hKNotes) {
HKNotes = hKNotes;
}
public String getTaskSheetName() {
return TaskSheetName;
}
public void setTaskSheetName(String taskSheetName) {
TaskSheetName = taskSheetName;
}
public int getStandardCleaningTime() {
return StandardCleaningTime;
}
public void setStandardCleaningTime(int standardCleaningTime) {
StandardCleaningTime = standardCleaningTime;
}
public int getAttendantPriority() {
return AttendantPriority;
}
public void setAttendantPriority(int attendantPriority) {
AttendantPriority = attendantPriority;
}
public String getSupervisorPriority() {
return SupervisorPriority;
}
public void setSupervisorPriority(String supervisorPriority) {
SupervisorPriority = supervisorPriority;
}
public String getTaskStartTime() {
return TaskStartTime;
}
public void setTaskStartTime(String taskStartTime) {
TaskStartTime = taskStartTime;
}
public String getTaskEndTime() {
return TaskEndTime;
}
public void setTaskEndTime(String taskEndTime) {
TaskEndTime = taskEndTime;
}
public String getTasksheetInstruction() {
return TasksheetInstruction;
}
public void setTasksheetInstruction(String tasksheetInstruction) {
TasksheetInstruction = tasksheetInstruction;
}
public String getLocalJobStatusCode() {
return localJobStatusCode;
}
public void setLocalJobStatusCode(String localJobStatusCode) {
this.localJobStatusCode = localJobStatusCode;
}
public Boolean getIsSynch() {
return isSynch;
}
public void setIsSynch(Boolean isSynch) {
this.isSynch = isSynch;
}
public String getCredit() {
return credit;
}
public void setCredit(String credit) {
this.credit = credit;
}
public String getRemainingTimeSec() {
return RemainingTimeSec;
}
public void setRemainingTimeSec(String remainingTimeSec) {
RemainingTimeSec = remainingTimeSec;
}
public String getTaskTypeId() {
return TaskTypeId;
}
public void setTaskTypeId(String taskTypeId) {
TaskTypeId = taskTypeId;
}
public String getAttendantCLTypeId() {
return AttendantCLTypeId;
}
public void setAttendantCLTypeId(String attendantCLTypeId) {
AttendantCLTypeId = attendantCLTypeId;
}
public String getSupervisorCLTypeId() {
return SupervisorCLTypeId;
}
public void setSupervisorCLTypeId(String supervisorCLTypeId) {
SupervisorCLTypeId = supervisorCLTypeId;
}
public String getTritonLocationID() {
return TritonLocationID;
}
public void setTritonLocationID(String tritonLocationID) {
TritonLocationID = tritonLocationID;
}
public String getPendingTritonJob() {
return PendingTritonJob;
}
public void setPendingTritonJob(String pendingTritonJob) {
PendingTritonJob = pendingTritonJob;
}
public Boolean getIsDiscrepancy() {
return isDiscrepancy;
}
public void setIsDiscrepancy(Boolean isDiscrepancy) {
this.isDiscrepancy = isDiscrepancy;
}
public Boolean getInspectionStatus() {
return InspectionStatus;
}
public void setInspectionStatus(Boolean inspectionStatus) {
InspectionStatus = inspectionStatus;
}
public Boolean getIsTaskInspected() {
return IsTaskInspected;
}
public void setIsTaskInspected(Boolean isTaskInspected) {
IsTaskInspected = isTaskInspected;
}
}
But it is giving class cast exception when I try to cast it to my data object.
Please help me to resolve this?
You are putting in an Array and expecting out a single object. Also, use ArrayList which is serializable.
Not sure what your TasksheetData class is, but maybe you should use your alltasks as a ParcelableArray instead.
Checkout this
Your array of TasksheetData is definitely not an instance of one Serializable class...

Categories

Resources