Point  |  API reference  |  Android Developers (original) (raw)


open class Point : Parcelable

Point holds two integer coordinates

Summary

Inherited constants
From class Parcelable Int CONTENTS_FILE_DESCRIPTOR Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor. Int PARCELABLE_WRITE_RETURN_VALUE Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point.
Public constructors
Point()
Point(src: Point)
Point(x: Int, y: Int)
Public methods
open Int describeContents() Parcelable interface methods
Boolean equals(x: Int, y: Int) Returns true if the point's coordinates equal (x,y)
open Boolean equals(other: Any?)
open Int hashCode()
Unit negate() Negate the point's coordinates
Unit offset(dx: Int, dy: Int) Offset the point's coordinates by dx, dy
open Unit readFromParcel(in: Parcel) Set the point's coordinates from the data stored in the specified parcel.
open Unit set(x: Int, y: Int) Set the point's x and y coordinates
open String toString()
open Unit writeToParcel(out: Parcel, flags: Int) Write this point to the specified parcel.
Properties
static Parcelable.Creator<Point!> CREATOR
Int x
Int y

Public constructors

Point

Point(src: Point)

Parameters
src Point: This value cannot be null.

Public methods

equals

fun equals(
    x: Int,
    y: Int
): Boolean

Returns true if the point's coordinates equal (x,y)

equals

open fun equals(other: Any?): Boolean

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

hashCode

open fun hashCode(): Int

Return
Int a hash code value for this object.

negate

fun negate(): Unit

Negate the point's coordinates

offset

fun offset(
    dx: Int,
    dy: Int
): Unit

Offset the point's coordinates by dx, dy

readFromParcel

open fun readFromParcel(in: Parcel): Unit

Set the point's coordinates from the data stored in the specified parcel. To write a point to a parcel, call writeToParcel().

Parameters
in Parcel: The parcel to read the point's coordinates from This value cannot be null.

set

open fun set(
    x: Int,
    y: Int
): Unit

Set the point's x and y coordinates

toString

open fun toString(): String

Return
String a string representation of the object.

writeToParcel

open fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit

Write this point to the specified parcel. To restore a point from a parcel, use readFromParcel()

Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES
out Parcel: The parcel to write the point's coordinates into

Properties

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.