Touching an object in a tweened animation?

by Michael » Fri, 23 Apr 2010 02:59:30 GMT


Sponsored Links
 I'm having trouble porting a simple game I developed for the iPhone
over to Android. The game has an animated ball which moves from Point
A to Point B. The user must touch the ball before it reaches point B
or lose the game. This was easy to implement on the iPhone using Core
Animation since I could locate the current position of the ball by
accessing its animation layer. In Android, I attempted to recreate the
game using tweened animation and represented the ball as a Drawable.
My issue is that I can't determine if the user is touching the spot
because the Drawable apparently bounds do not update as the ball
visually moves - making the program think the ball is always in its
original position. While searching these forums I saw an Android team
dev. confirm that you can't get the current location in a tweened
animation but offered no solution for a workaround. Can I accomplish
this on the Android using my current approach? If not, what approach
should I use?

Best regards,
Michael

--



Other Threads

1. Problem using a custom font (not rendered on some devices)

Hello folks.

I've stumbled upon a small problem in my app which is driving me
insane and i can't seem to find any viable solution for this.

In my app i use a custom font which shouldn't be a big problem but
actually is.

Neither the Nexus One (running v2.2.2) or the emulator could render
the text with this typefont. The textviews just remained empty with no
size, as if there was no text given.
A Samsung Galxy Tab and the Samsung Galaxy S don't have any problems
with this font.
(I'm sorry since this is a private font i can't provide it here)

First question is if anybody ever experienced a similar problem and
maybe found a solution?
I couldn't find any so i tried a different approach:

I created a custom view extending the TextView class and tried to
overwirte the onDraw method to actually draw my text word by word
using a paint object.
This worked to some degree: at least the text was drawn but it was
missing some effects from the font. So it was just white text. I could
live with that but some characters still make problems: , , , , 
and .
These characters are just displayed as a rectangle with white border.

I tried some things about this whole mess, even playing around with
the original ttf file but it had no effects.
Maybe someone here has an idea which could point me in the right
direction to solve this problem, or even solved it already.

 thank you and best regards

-- 

2. Trying to make a todo-list with ListView

Hello all.

I'm trying to build a todo-list using a ListView, but I'm having
problems, as when I launch that list, I get errors.

This is my XML file defining the list itself (tasks.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    <ListView android:id="@+id/android:list"
          android:layout_width="fill_parent"
                android:layout_height="fill_parent"/>
        <TextView android:id="@+id/android:empty"
          android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/no_tasks"/>
</LinearLayout>

This is my XML file defining a row in the list (tasks_list_row.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
        <CheckBox android:id="@+id/checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        <TextView android:id="@+id/task_title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
</LinearLayout>

So, in my class (that extends ListActivity) I call the list this way:

setContentView(R.layout.tasks);
final String[] items = new String[] { "one", "two", "three" };
setListAdapter(new ArrayAdapter<String>(this, R.id.task_title,
R.layout.tasks_list_row, items));


When I run my app, I get this error:

android.content.res.Resources$NotFoundException: Resource ID
#0x7f050006 type #0x12 is not valid


How could I avoid this error? What am I doing wrong?

-- 

3. About PID, TID, and memory usage

4. RemoteViews.setRelativeScrollPosition Example?

5. crypto DES

6. Find storage directories?

7. How do the "drop down" ads like in the weather channel app work?