package org.ashanet;

import android.app.Application;
import android.content.res.Resources;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseObject;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import org.ashanet.typedef.Project;

public class AshaNetApp extends Application {

    public String parseAppId;

    @Override
    public void onCreate() {
        super.onCreate();
        LineNumberReader lnr = new LineNumberReader
            (new InputStreamReader
             (getResources().openRawResource(R.raw.keys)));

        registerClasses();

        String parseClientKey;

        try {
            parseAppId = lnr.readLine();
            parseClientKey = lnr.readLine();


            Parse.initialize(this, parseAppId, parseClientKey);
            Log.d("DEBUG", "Successfully initialized");
        }
        catch (IOException ioe) {
            Log.e("DEBUG", "Failed to read keys", ioe);
        }
    }

    private void registerClasses() {
        ParseObject.registerSubclass(Project.class);
    }
}

package org.ashanet;

import android.app.Application;
import android.content.res.Resources;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseObject;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import org.ashanet.typedef.Event;
import org.ashanet.typedef.Project;

public class AshaNetApp extends Application {

    public String parseAppId;

    @Override
    public void onCreate() {
        super.onCreate();
        LineNumberReader lnr = new LineNumberReader
            (new InputStreamReader
             (getResources().openRawResource(R.raw.keys)));

        registerClasses();

        String parseClientKey;

        try {
            parseAppId = lnr.readLine();
            parseClientKey = lnr.readLine();


            Parse.initialize(this, parseAppId, parseClientKey);
            Log.d("DEBUG", "Successfully initialized");
        }
        catch (IOException ioe) {
            Log.e("DEBUG", "Failed to read keys", ioe);
        }
    }

    private void registerClasses() {
        ParseObject.registerSubclass(Project.class);
        ParseObject.registerSubclass(Event.class);
    }
}

Fix up a parse error
Fix up a parse error

The non-generic ParseQueryAdapter class fails when results are read due
to a cast error:

    java.lang.ClassCastException: com.parse.ParseObject cannot be cast to org.ashanet.typedef.Event
    	at org.ashanet.adapter.EventListAdapter.getItemView(EventListAdapter.java:20)
    	at com.parse.ParseQueryAdapter.getView(ParseQueryAdapter.java:546)
    	at android.widget.AbsListView.obtainView(AbsListView.java:2033)
    	at android.widget.ListView.makeAndAddView(ListView.java:1772)
    	at android.widget.ListView.fillDown(ListView.java:672)
    	at android.widget.ListView.fillFromTop(ListView.java:732)
        ...

This is because the type parameter was not registered.  Register it in
the Application class.
