Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Android
Parcelable
Monica Salvador
Greenhorn
Posts: 23
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I tried using the Parcelable interface for all of my custom classes. But there are StackOverflow errors when I pass a bitmap/any of those parcelables through the intent. Here's a sample code for one of the classes.
import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; public class Category implements Parcelable{ int id; String name; Bitmap logo = null; public Category(){ } //setter&getter @Override public int describeContents() { // TODO Auto-generated method stub return 0; } public Category(Parcel in){ this.id = in.readInt(); this.name = in.readString(); this.logo = in.readParcelable(Bitmap.class.getClassLoader()); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(id); dest.writeString(name); dest.writeParcelable(logo, flags); } public static final Parcelable.Creator<Category> CREATOR = new Parcelable.Creator() { public Category createFromParcel(Parcel in) { return new Category(in); } public Category[] newArray(int size) { return new Category[size]; } }; }
The error that is showing in the LogCat is here:
dest.writeParcelable(logo, flags);
I don't know what I did wrong. please help me.
Hussein Baghdadi
clojure forum advocate
Posts: 3479
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Would you please post the stack trace here so we can get a better info?
Monica Salvador
Greenhorn
Posts: 23
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The problem's now solved. It had a StackOverflow because I was sending many images through an intent.
Monu Tripathi
Rancher
Posts: 1369
1
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
As an aside, it is not advisable to pass large Bitmaps in Intent extras. You will run into all sort of issues.
[
List of FAQs
] | [
Android FAQ
] | [
Samuh Varta
]
Don't play dumb with me! But you can try this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Filtering Result Sets based on selectable links (a href:)
Retrieve Node of tree in next page using jsp, struts tiles, Dojo
Get byte[] of image
Sort by price and sort by provence
JTable repaint issue
More...