Giter Club home page Giter Club logo

Comments (10)

noelb avatar noelb commented on July 21, 2024

I'm seeing the same error when using the 1.1 jar. It cleared up when I pulled down the latest source and just dropped it in directly. The jar may need to be rebuilt?

from sugar.

satyan avatar satyan commented on July 21, 2024

Yes. It has been corrected in the latest code. It was an incorrect path in the inflate method of SugarRecord. You could build the jar again or use it as library. I'll release the 1.2 jar soon.

thanks.
Satya

from sugar.

noelb avatar noelb commented on July 21, 2024

Thanks Satyan! Terrific library, btw, extremely simple and lightweight.

from sugar.

satyan avatar satyan commented on July 21, 2024

Thanks @noelb .. Let me know if you have any ideas to improve it further..

Closing this issue.

from sugar.

hendrikschneider avatar hendrikschneider commented on July 21, 2024

Thanks. Cool lib by the way :)

from sugar.

Marwen1990 avatar Marwen1990 commented on July 21, 2024

Hi, I use the version 1.2 of sugar and I have an error message "class cannot be read from sqlite3 database" so I can't modify the value of a column. Any suggestions to fix this?

from sugar.

satyan avatar satyan commented on July 21, 2024

@Marwen1990 can you post your class here (or in private to me).. thanks.

from sugar.

Marwen1990 avatar Marwen1990 commented on July 21, 2024

package com.example.newproject;

import android.content.Context;

import com.orm.SugarRecord;

public class Contact extends SugarRecord{

private static Context context;
private String nom;
private String phoneNo;
Groupe groupe;
boolean selected = false;

public Contact(Context context){
    super(context);
}

public Contact(String nom, String phoneNo, boolean selected) {
  super(context);
  this.nom = nom;
  this.phoneNo = phoneNo;
  this.selected = selected;
 }

public Contact(Context context, String nom, String phoneNo,Groupe groupe) {
    super(context);
    this.nom = nom;
    this.phoneNo=phoneNo;
    this.groupe=groupe;
}

public Contact(String nom, String phoneNo,Groupe groupe) {
    super(null);
    this.nom = nom;
    this.phoneNo=phoneNo;
    this.groupe=groupe;
}

public String getNom() {
    return nom;
}

public void setNom(String nom) {
    this.nom = nom;
}



public String getPhoneNo() {
    return phoneNo;
}

public void setPhoneNo(String phoneNo) {
    this.phoneNo = phoneNo;
}

public Groupe getGroupe() {
    return groupe;
}

public void setGroupe(Groupe groupe) {
    this.groupe = groupe;
}

@Override
public String toString() {
    return  nom + "\r\n" + phoneNo + " "+id ;
}

public boolean isSelected() {
      return selected;
}

public void setSelected(boolean selected) {
      this.selected = selected;
}

}

Activity :

package com.example.newproject;

import java.util.List;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ListView;

import com.orm.query.Select;

public class CheckActivity extends ListActivity {

private ListView listview;


protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contactbase);


    listview = (ListView) findViewById(android.R.id.list);
    getListView().setOnCreateContextMenuListener(this);

    @SuppressWarnings("unchecked")
    List<Contact> contacts = Select.from(Contact.class).list();
    ContactAdapter3 objAdapter = new ContactAdapter3(CheckActivity.this, R.layout.contact_check, contacts);
    listview.setAdapter(objAdapter);
}

public void MyHandler(View v) {
    CheckBox cb = (CheckBox) v;

    if (cb.isChecked()) {
        CharSequence nom = cb.getText();
        String nom1= nom.toString();
        List<Contact> con = Contact.find(Contact.class, "nom= ?", nom1);
        Contact coo = con.get(0);
        Contact cc=Contact.findById(Contact.class,coo.getId() );
        System.out.println("la position est : "+coo.getId());
        cc.setSelected(true);


    } else {
        CharSequence nom = cb.getText();
        String nom1= nom.toString();
        List<Contact> con = Contact.find(Contact.class, "nom= ?", nom1);
        Contact coo = con.get(0);
        Contact cc=Contact.findById(Contact.class,coo.getId() );
        System.out.println("la position est : "+coo.getId());

        cc.setSelected(false);
    }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add( 1 , 1 , 3 , "Enregistrer");
    return super.onCreateOptionsMenu(menu);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {

    Intent i = new Intent (getApplicationContext(), GroupeListActivity.class);
    startActivity(i);
    return super.onOptionsItemSelected(item);
}

}

from sugar.

satyan avatar satyan commented on July 21, 2024

Do you need the context property in contact class? That looks like the issue.
You can remove that and try. If you want to retain that, please annotate with @ignore

That would make sure that sugar doesn't try to persist context.
Let me know if this resolves the issue.

from sugar.

Marwen1990 avatar Marwen1990 commented on July 21, 2024

Or without Context haw can I save an element in the table contact for example? I tried to remove the Context but when I try to save an element an error "Nullpointerexception" was made.

from sugar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.