Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:24:13+00:00 2026-05-29T07:24:13+00:00

I have Class A with an instance variable ImageView. Currently I use setTag() to

  • 0

I have Class A with an instance variable ImageView. Currently I use setTag() to get from the ImageView back to the instance of Class A. Could that present circular loop? I also heard of mention of weak references. What is the best way to get at the parent Class A of the ImageView?

My usage scenario is I am dragging the ImageView around the screen and I need to access class A for information about the ImageView being dragged.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:24:14+00:00Added an answer on May 29, 2026 at 7:24 am

    I believe that Dalvik VM doesn’t have problem with detecting circular references.

    Here’s Q/A that discusses this: Circular References in Java

    Only a very naive implementation would have a problem with circular
    references.

    I’d use setTag to hold ref to related object. Also, using setTag/getTag on View is standard and recommended approach to achieve various optimizations on Android, even found in Android samples.
    Some references:

    http://www.vogella.de/articles/AndroidListView/article.html#ownadapter_viewHolder

    Android Custom Listview

    If Android’s GC would have problem to detect such dependencies, Android would not work as it works.
    Go ahead and use View.setTag if it suits your purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class that has as an instance variable of a coordinate:
I have a global variable that is an instance of my custom class. How
Let's say we have a class foo which has a private instance variable bar
I have a class Page that creates an instance of DB , which is
I have a public class which has the following method and instance variable: public
I have a class with an instance variable of type SEL, which is a
When I call self.class.instance_variable_set(@var, ...) from inside a class method, where is that variable
I have a Class with an instance variable of an NSArray of different objects
How can I use a class instance variable as an argument for a method
If I have a class, how can I list all its instance variable names?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.