Comments (10)
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.
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.
Thanks Satyan! Terrific library, btw, extremely simple and lightweight.
from sugar.
Thanks @noelb .. Let me know if you have any ideas to improve it further..
Closing this issue.
from sugar.
Thanks. Cool lib by the way :)
from sugar.
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.
@Marwen1990 can you post your class here (or in private to me).. thanks.
from sugar.
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.
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.
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)
- Issue with Multiple Entitys
- Support for user specified ID's being used in the database instead of having them generated automatically.
- Android Studio 3.2.1 DB is no longer created HOT 3
- Is Sugar ORM library affected by the newly found SQLite vulnerability?
- update bug HOT 1
- [QUESTION] Where I can find the CI service?
- OneToMany Annotation
- Missing saveAll() for nested Table
- How read existing DB from assets folder? HOT 1
- Como deletar todos os dados de uma tabela e depois verificar se a tabela está vazia? HOT 1
- No such table with migration HOT 2
- ava.lang.NoSuchMethodException: <init> []
- SugarRecord Read / write separation
- bulk data not inserted completely
- Caused by: android.database.sqlite.SQLiteException: no such table: HOT 5
- *.db file is empty, but in application all the lines are shown.
- RuntimeException on start
- 我使用save来保存数据但是数据当中设置了不可重复字段会对其进行覆盖
- build failed when sync graddle HOT 1
- no such column when select
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sugar.