alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Android example source code file (PanoramioItem.java)

This example Android source code file (PanoramioItem.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Android by Example" TM.

Java - Android tags/keywords

android, bitmap, creator, drawing, geopoint, graphics, maps, os, paint, panoramioitem, parcelable, string

The PanoramioItem.java Android example source code

/*
 * Copyright (C) 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.panoramio;

import com.google.android.maps.GeoPoint;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Holds one item returned from the Panoramio server. This includes
 * the bitmap along with other meta info.
 *
 */
public class PanoramioItem implements Parcelable {
    
    private long mId;
    private Bitmap mBitmap;
    private GeoPoint mLocation;
    private String mTitle;
    private String mOwner;
    private String mThumbUrl;
    private String mOwnerUrl;
    private String mPhotoUrl;
    
    public PanoramioItem(Parcel in) {
        mId = in.readLong();
        mBitmap = Bitmap.CREATOR.createFromParcel(in);
        mLocation = new GeoPoint(in.readInt(), in.readInt());
        mTitle = in.readString();
        mOwner = in.readString();
        mThumbUrl = in.readString();
        mOwnerUrl = in.readString();
        mPhotoUrl = in.readString();
    }
    
    public PanoramioItem(long id, String thumbUrl, Bitmap b, int latitudeE6, int longitudeE6,
            String title, String owner, String ownerUrl, String photoUrl) {
        mBitmap = b;
        mLocation = new GeoPoint(latitudeE6, longitudeE6);
        mTitle = title;
        mOwner = owner;
        mThumbUrl = thumbUrl;
        mOwnerUrl = ownerUrl;
        mPhotoUrl = photoUrl;
    }
    
    public long getId() {
        return mId;
    }
    
    public Bitmap getBitmap() {
        return mBitmap;
    }

    public GeoPoint getLocation() {
        return mLocation;
    }
    
    public String getTitle() {
        return mTitle;
    }
    
    public String getOwner() {
        return mOwner;
    }
    
    public String getThumbUrl() {
        return mThumbUrl;
    }

    public String getOwnerUrl() {
        return mOwnerUrl;
    }

    public String getPhotoUrl() {
        return mPhotoUrl;
    }

    public static final Parcelable.Creator<PanoramioItem> CREATOR =
        new Parcelable.Creator<PanoramioItem>() {
        public PanoramioItem createFromParcel(Parcel in) {
            return new PanoramioItem(in);
        }

        public PanoramioItem[] newArray(int size) {
            return new PanoramioItem[size];
        }
    };

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeLong(mId);
        mBitmap.writeToParcel(parcel, 0);
        parcel.writeInt(mLocation.getLatitudeE6());
        parcel.writeInt(mLocation.getLongitudeE6());
        parcel.writeString(mTitle);
        parcel.writeString(mOwner);
        parcel.writeString(mThumbUrl);
        parcel.writeString(mOwnerUrl);
        parcel.writeString(mPhotoUrl);
   }
}

Other Android examples (source code examples)

Here is a short list of links related to this Android PanoramioItem.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.