Back to project page Netball.
The source code is released under:
GNU General Public License
If you think the Android project Netball listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.prisch.repositories; /*from w w w .j a v a 2 s .co m*/ import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.CursorLoader; import android.net.Uri; import com.prisch.content.NetballContentProvider; import com.prisch.model.Player; public class PlayerRepository { private Context context; private TeamMemberRepository teamMemberRepository; public PlayerRepository(Context context) { this.context = context; this.teamMemberRepository = new TeamMemberRepository(context); } // ===== Interface ===== public long createPlayer(String name) { ContentValues contentValues = new ContentValues(); contentValues.put(Player.NAME, name); Uri resultUri = context.getContentResolver().insert(NetballContentProvider.URI_PLAYERS, contentValues); return ContentUris.parseId(resultUri); } public void deletePlayer(Long id) { String where = Player.ID + "=?"; String[] parameters = new String[] {id.toString()}; context.getContentResolver().delete(NetballContentProvider.URI_PLAYERS, where, parameters); } public void renamePlayer(Long id, String name) { ContentValues contentValues = new ContentValues(); contentValues.put(Player.NAME, name); String where = Player.ID + "=?"; String[] parameters = new String[] {id.toString()}; context.getContentResolver().update(NetballContentProvider.URI_PLAYERS, contentValues, where, parameters); } public CursorLoader getAllPlayers() { return new CursorLoader(context, NetballContentProvider.URI_PLAYERS, null, null, null, Player.NAME); } }