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 7573563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:12:50+00:00 2026-05-30T16:12:50+00:00

I am a beginner in Android. I am developing one animated game in Activity(not

  • 0

I am a beginner in Android. I am developing one animated game in Activity(not use canvas or surface view an not draw any things). I have faced with one problem is that – while vehicle is moving from the left side to the right side of the screen I want to perform some task till vehicle is visible on the screen. But, I’m unable to do it in a right way. How I can get to know if the vehicle is Visible on the screen and also, when it crosses the screen?
For this I was using this code till now-

 <?xml version="1.0" encoding="utf-8"?>
 <translate xmlns:android="http://schemas.android.com/apk/res/android"
  android:fromXDelta="-50%"
  android:toXDelta="170%"
  android:fromYDelta="0%"
  android:toYDelta="0%" 
  android:duration="6000" 
  android:zAdjustment="bottom"
 />

and implement it in Activity as–

    final Animation a = AnimationUtils.loadAnimation(this, R.anim.translate);
      a.reset();
      vehicleView.setImageResource(R.drawable.benz_rock_1);
      vehicleView.startAnimation(a);

Now How I can get if the car is on the screen or out of screen? Sorry for my english…

  • 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-30T16:12:51+00:00Added an answer on May 30, 2026 at 4:12 pm

    I see two possible solutions for that

    You can use View.getGlobalVisibleRect. It returns true if your view is in the screen, so you can easily do whatever you need.

    Or you can use View.getLocationOnScreen(Int[] location). And as written on the documentation:

    location an array of two integers in which to hold the coordinates

    You can use any of this two methods to detect if it’s in the screen or not!

    Hope it helps!

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

Sidebar

Related Questions

I am beginner in the android development, can any one tell me how to
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I have
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I am a beginner in developing for the Android, so excuse me if this
I'm a beginner in Android development but not in programming itself. Anyway, this question
I am a beginner Android developer and I am trying to make a game
(I am a beginner at android, so be nice!) I am making a game
i'm a beginner in android and have not much experience on java... I have

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.