Android Open Source - sugar Sugar Activity






From Project

Back to project page sugar.

License

The source code is released under:

Copyright (C) 2012 by Satya Narayan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the S...

If you think the Android project sugar 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.example;
//  ww w . j  a v a 2  s  .  c o m
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.orm.SugarRecord;

import static com.orm.SugarRecord.save;

public class SugarActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        SugarRecord.deleteAll(Note.class);
        SugarRecord.deleteAll(TextNote.class);
        SugarRecord.deleteAll(Tag.class);
        SugarRecord.deleteAll(NewNote.class);
        initDb();
        Intent intent = new Intent(this, NoteListActivity.class);
        startActivity(intent);
    }

     private void initDb() {

        Tag t1 = new Tag("tag1");
        Tag t2 = new Tag("tag2");
         save(t1);
         save(t2);

        Note n1 = new Note( 10, "note1", "description1", t1);
        Note n2 = new Note(11, "note12", "description2", t1);
        Note n3 = new Note( 12, "note13", "description3", t2);
        Note n4 = new Note( 13, "note4", "description4", t2);

         TextNote textNote = new TextNote();
         textNote.desc = "Test";

         save(textNote);
         save(n1);
         save(n2);
         save(n3);
         save(n4);

         n1.setDescription("matrix");
         n1.setTitle("atrix");
         save(n1);
         n2.setDescription("matrix");
         n2.setTitle("satrix");
         save(n2);
         n3.setDescription("matrix");
         n3.setTitle("batrix");
         save(n3);

         NewNote newNote = new NewNote();
         newNote.name = "name";
         save(newNote);

     }
}




Java Source Code List

com.example.AddNoteActivity.java
com.example.ClientApp.java
com.example.NewNote.java
com.example.NoteListActivity.java
com.example.NoteRelation.java
com.example.Note.java
com.example.SugarActivity.java
com.example.Tag.java
com.example.TextNote.java
com.orm.SchemaGenerator.java
com.orm.SugarApp.java
com.orm.SugarContext.java
com.orm.SugarDb.java
com.orm.SugarRecord.java
com.orm.SugarTransactionHelper.java
com.orm.dsl.Column.java
com.orm.dsl.Ignore.java
com.orm.dsl.NotNull.java
com.orm.dsl.Table.java
com.orm.dsl.Unique.java
com.orm.query.Condition.java
com.orm.query.Select.java
com.orm.util.Collection.java
com.orm.util.ManifestHelper.java
com.orm.util.NamingHelper.java
com.orm.util.NumberComparator.java
com.orm.util.QueryBuilder.java
com.orm.util.ReflectionUtil.java
com.orm.util.SugarConfig.java
com.orm.util.SugarCursorFactory.java