This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.schematiclibrary.provider; | |
import android.net.Uri; | |
import net.simonvt.schematic.annotation.ContentProvider; | |
import net.simonvt.schematic.annotation.ContentUri; | |
import net.simonvt.schematic.annotation.InexactContentUri; | |
import net.simonvt.schematic.annotation.TableEndpoint; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.schematiclibrary.provider; | |
import net.simonvt.schematic.annotation.Database; | |
import net.simonvt.schematic.annotation.Table; | |
/** | |
* THis is the database class. It is used to define the tables in database and database version. | |
*/ | |
@Database(version = DatabaseClass.VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.schematiclibrary.provider; | |
import net.simonvt.schematic.annotation.AutoIncrement; | |
import net.simonvt.schematic.annotation.ConflictResolutionType; | |
import net.simonvt.schematic.annotation.DataType; | |
import net.simonvt.schematic.annotation.NotNull; | |
import net.simonvt.schematic.annotation.PrimaryKey; | |
/** | |
* This class defines the structure of the table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.simpledatabase.database; | |
import android.content.ContentProvider; | |
import android.content.ContentUris; | |
import android.content.ContentValues; | |
import android.content.UriMatcher; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.net.Uri; | |
import android.support.annotation.NonNull; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.simpledatabase.database; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
public class DataHelper extends SQLiteOpenHelper { | |
public static final String DATABASE_NAME = "data.db"; | |
public static final int DATABASE_VERSION = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.simpledatabase.database; | |
import android.content.ContentResolver; | |
import android.net.Uri; | |
import android.provider.BaseColumns; | |
public class DataContract { | |
public DataContract() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DataAdapter extends RecyclerView.Adapter<DataAdapter.ViewHolder> { | |
private static final String TAG = "DataAdapter"; | |
private Context context; | |
private Cursor mCursor; | |
public DataAdapter(Context context,Cursor cursor) { | |
this.context = context; | |
mCursor = cursor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------------------------------------------------------- | |
DDL COMMMANDS | |
-------------------------------------------------------------------------------------------------------------------------------- | |
> Create | |
----------- | |
creates table | |
=> create table table_name(col1 datatype,col2 datatype); | |
> Drop => | |
----------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String createUrl() { | |
UId = mUser.getKey(); | |
if (UId.isEmpty()) { | |
Snackbar.make(findViewById(R.id.main_activity_layout), | |
"You need to save your data to the cloud first!", | |
Snackbar.LENGTH_INDEFINITE) | |
.setAction("Add", new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { |
NewerOlder