Android Open Source - fooplayer-android Bean






From Project

Back to project page fooplayer-android.

License

The source code is released under:

GNU General Public License

If you think the Android project fooplayer-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mauriciogiordano.fooplayer.database;
// w w  w. j ava2s . c o m
import android.content.Context;
import com.j256.ormlite.dao.Dao;
import java.sql.SQLException;

public class Bean<T> {

    protected Class<T> clazz;

    public Bean(Class<T> clazz)
    {
        this.clazz = clazz;
    }

    protected Dao<T, Integer> getDao(Context context)
    {
        Dao<T, Integer> dao = null;

        try {
            dao = DatabaseHelper.getInstance(context).getDao(clazz);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return dao;
    }

    protected boolean save(Context context, T object)
    {
        Dao<T, Integer> dao = getDao(context);

        Dao.CreateOrUpdateStatus status;

        try {
            status = dao.createOrUpdate(object);

            return status.isCreated() || status.isUpdated();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return false;
    }

}




Java Source Code List

com.mauriciogiordano.fooplayer.AlbumsActivity.java
com.mauriciogiordano.fooplayer.ApplicationTest.java
com.mauriciogiordano.fooplayer.FooActivity.java
com.mauriciogiordano.fooplayer.TracksActivity.java
com.mauriciogiordano.fooplayer.adapter.AlbumsAdapter.java
com.mauriciogiordano.fooplayer.adapter.ArtistsAdapter.java
com.mauriciogiordano.fooplayer.adapter.TracksAdapter.java
com.mauriciogiordano.fooplayer.config.Constants.java
com.mauriciogiordano.fooplayer.database.Album.java
com.mauriciogiordano.fooplayer.database.Artist.java
com.mauriciogiordano.fooplayer.database.Bean.java
com.mauriciogiordano.fooplayer.database.DatabaseHelper.java
com.mauriciogiordano.fooplayer.database.Track.java
com.mauriciogiordano.fooplayer.fragment.AlbumsFragment.java
com.mauriciogiordano.fooplayer.fragment.ArtistsFragment.java
com.mauriciogiordano.fooplayer.fragment.TracksFragment.java
com.mauriciogiordano.fooplayer.network.Delegate.java
com.mauriciogiordano.fooplayer.network.Endpoints.java
com.mauriciogiordano.fooplayer.network.HttpClientHelper.java
com.mauriciogiordano.fooplayer.network.ImageHelper.java
com.mauriciogiordano.fooplayer.network.Network.java
com.mauriciogiordano.fooplayer.network.YouTubeUtility.java
com.mauriciogiordano.fooplayer.view.TextView.java