problem in adding animation to imageview

by uru » Tue, 01 Jul 2008 14:07:08 GMT

Sponsored Links


import android.os.Bundle;
import android.view.animation.TranslateAnimation;

import android.widget.ImageView;

public class checkr extends Activity {

    public void onCreate(Bundle icicle) {
        ImageView i1;
        TranslateAnimation trans1 = new TranslateAnimation(0, 30, 0,


this code gives nullpointerexception


problem in adding animation to imageview

by Mark Murphy » Tue, 01 Jul 2008 15:18:13 GMT

 > this code gives nullpointerexception

Move your setContentView() statement to be just under the super.onCreate()

You are attempting to find a widget (findViewById()) before the widget
exists (setContentView()).

If that does not help, could you let us know what line is causing the

Mark Murphy (a Commons Guy) 
_The Busy Coder's Guide to Android Development_ -- Available Now!


Sponsored Links

problem in adding animation to imageview

by uru » Fri, 04 Jul 2008 20:25:40 GMT

 thanksss it works.........


Other Threads

1. StackOverflowError on drawing Spannable string

for some reason the append caused this issue.
replacing it with setText() solved the issue.


2. Pass event to parent view?

I have a layout which contains five TextView. When user clicks any of
the five TextView, it will do the same thing: open another activity.
So, the OnClickerListener behavior to the five TextView is the same.
Is it possible that I only add OnClickListerner to one view, e.g. to
layout, so I don't have to add OnClickListerner to each of the five
TextView? Put it another way, if none of the children components
receives CLICK event, will the CLICK event passed through to their
parent, the layout?


3. Unit Testing

4. Settings.Secure.HTTP_PROXY (and proxy behaviour in general)

5. How can I add a transparent & scalable marker on Google map?

6. Better Keyboard 4.3

7. Using OS 1.6 and Up , are we penalized on the market ?