Re: Digest for seattle-java-android-study-sessions@googlegroups.com - 5 Messages in 1 Topic

22 views
Skip to first unread message

Bob Marley

unread,
Jan 9, 2012, 8:08:16 PM1/9/12
to seattle-java-andr...@googlegroups.com
Importing the project I am getting the following errors.
-miene

Description Resource Path Location Type
The method eventOccurred(EventObject) of type new SpiteEventListener(){} must override a superclass method Ball.java /Vivace/src/com/vivace/sprite line 25 Java Problem
The method eventOccurred(EventObject) of type new SpiteEventListener(){} must override a superclass method Vivace.java /Vivace/src/com/vivace line 61 Java Problem
The method onClick(View) of type new View.OnClickListener(){} must override a superclass method Vivace.java /Vivace/src/com/vivace line 104 Java Problem
The method onClick(View) of type new View.OnClickListener(){} must override a superclass method Vivace.java /Vivace/src/com/vivace line 119 Java Problem
The method onProgressChanged(SeekBar, int, boolean) of type Preferences must override a superclass method Preferences.java /Vivace/src/com/vivace line 46 Java Problem
The method onStartTrackingTouch(SeekBar) of type Preferences must override a superclass method Preferences.java /Vivace/src/com/vivace line 52 Java Problem
The method onStopTrackingTouch(SeekBar) of type Preferences must override a superclass method Preferences.java /Vivace/src/com/vivace line 56 Java Problem
The method onTouch(View, MotionEvent) of type new View.OnTouchListener(){} must override a superclass method Vivace.java /Vivace/src/com/vivace line 88 Java Problem
The method run() of type DrawEngine must override a superclass method DrawEngine.java /Vivace/src/com/vivace line 22 Java Problem



On Mon, Jan 9, 2012 at 4:22 PM, <seattle-java-andr...@googlegroups.com> wrote:

Group: http://groups.google.com/group/seattle-java-android-study-sessions/topics

    Jose Collas <jose....@goatstone.com> Jan 09 02:21PM -0800  

    Getting the Code:
     
    the git command:
     
    git clone g...@github.com:goatstone/Vivace.git
     
     
    Go to Eclipse, under:
    File ->
    New -> Android Project
     
    When the dialog appears:
    For Name put in:
     
    Vivace
     
    click:
    "Create project from existing source"
     
    and under "Location" select the folder you have just cloned from
    github "Vivace"
     
    and click
     
    "Finnish"

     

    Jose Collas <jose....@goatstone.com> Jan 09 02:25PM -0800  

    Basic UI: View, ViewGroups : Intents, Activities : Life Cycle

     

    Jose Collas <jose....@goatstone.com> Jan 09 02:26PM -0800  

    Basic UI: View, ViewGroups : Intents, Activities : Life Cycle

     

    Jose Collas <jose....@goatstone.com> Jan 09 03:24PM -0800  

    Notes for the study session 1.9.2012
     
    "View, ViewGroups : Intents, Activities : Life Cycle"
     
    ======================
    Views
     
    Extends Object
     
    Built in:
    Button restart
     
    Custom to Vivace:
    SpriteCanvas spriteCanvas
     
    "This class represents the basic building block for user interface
    components."
    "View is the base class for widgets, which are used to create
    interactive UI components (buttons, text fields, etc.)."*
     
     
    ======================
    ViewGroups
     
    Extends View
     
    Application ViewGroups:
    MainLayout(Programmatic)
    Preferences(XML)
     
    The Base class for layouts
     
    "A ViewGroup is a special view that can contain other views (called
    children.)
    The view group is the base class for layouts and views containers.
    This class also defines the ViewGroup.LayoutParams class
    which serves as the base class for layouts parameters."*
     
    It can be defined with XML or with code. What are the pros and cons of
    the two?
     
     
    ======================
    Intents
     
    Vivace uses intents to navigate from the Main screen to the
    Preferences screen.
     
    "An intent is an abstract description of an operation to be performed.
    It can be used with startActivity to launch an Activity,"*
     
    Intent intent = new Intent(spriteCanvas.getContext(),
    Preferences.class);
    // intent.putExtra("ballSize", String.valueOf(ballSize));
    intent.putExtra("ballSize", String.valueOf((int) Ball.rad));
    // startActivity(intent);
    startActivityForResult(intent, 1);
     
     
    ======================
    Activities
     
    "An activity is a single, focused thing that the user can do. Almost
    all activities interact with the user, so the Activity class takes
    care of creating a window for you in which you can place your UI with
    setContentView(View)."*
     
    The example app. Vivace has two Activities:
     
    Vivace
    Preferences
     
    The activity Vivacy is the main screen while, Preferences only
    modifies a user preference.
    The Activity Preferences takes a dotSize value and returns dotSize
    value that the user has selected.
    This Activity simply gets a value and returns a value, promoting
    Activity independence.
     
     
    ======================
    Object Independence With Events.
    This is about Java not Android specifically.
    I am only suggesting and experimenting with this in the context of
    Android.
    How else can this be done?
    How do different classes communicate?
     
    In Vivace the Sprites have a event system.
    The Ball objects raise BallCaught events and scoring is done based on
    these.
     
    In the com.vivace.event package:
     
    interface SpiteEventListener extends EventListener
     
    class BallCaught extends EventObject
    public BallCaught(Object source, int points) {
    super(source);
    this.points = points;
    }
     
     
    Inside Sprite:
     
    public void setSpriteListener(SpiteEventListener listener) {
    events.add(listener);
    }
     
     
    protected void trigger(EventObject evt) {
    for (Object o : events) {
    ((SpiteEventListener) o).eventOccurred(evt);
    }
    }
     
    Inside Vivace:
    // b is the sprite 'Ball'.
    b.setSpriteListener(new SpiteEventListener() {
    @Override
    public void eventOccurred(EventObject evt) {
    if (evt.getClass().getSimpleName().equals("BallCaught")) {
    // do something when the "BallCaught" event occurs
    }
    }
    });
     
    Inside Ball:
    // trigger the event BallCaught with the points for this ball
    trigger(new BallCaught(this, points));
     
    // listen for the events internally
    setSpriteListener(new SpiteEventListener() {
    public void eventOccurred(EventObject evt) {
    // do something when the event occurs
    }
    });
     
     
     
    * Quotes from Google Reference Site:
    http://developer.android.com/reference/

     

You received this message because you are subscribed to the Google Group seattle-java-android-study-sessions.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.


Reply all
Reply to author
Forward
0 new messages