-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to store an array of strings in Realm #5701
Comments
Did you see this: https://realm.io/docs/java/latest#lists-of-primitives? Please list the SO questions. They are likely old and we should update the answers. Also let us know how we can make it more discoverable in the docs! |
Perhaps we should have it as an example in the first model we show under "Models". |
Thanks for your response, Ill go over through the link https://realm.io/docs/java/latest#lists-of-primitives. here are some of the links that I have been searching through: |
Use |
@FahdSaif Thanks for those links! I've now posted updates to all 3. Let me know if you can find more :-) |
Hi,
I am wanting to store an array of strings in realm through my object.Although I am new to realm but i have read through the documentation completely and also tried out samples. Here is my example model.From what i have gathered so far on stackoverflow that this is not possible to store an array of strings inside an object we are putting in realm? Is my understanding and findings correct?
package com.example.fahdsaif.realmtest;
import java.util.ArrayList;
import java.util.List;
import io.realm.RealmObject;
/**
*/
public class RealmModel extends RealmObject {
private String firstName;
private String lastName;
private String meraarray[] = new String[10];
}
and here is the realm code for inserting into this model:
some code then...
myrealm.executeTransactionAsync(new Realm.Transaction() {
@OverRide
public void execute(Realm bgrealm) {
RealmModel myrealmModel = bgrealm.createObject(RealmModel.class);
//INSERTION
myrealmModel.setFirstName("aik aur stable");
myrealmModel.setLastName("aik aur kam stable");
myrealmModel.setMeraarray(meraarraykavalues);
}
}, new Realm.Transaction.OnSuccess() {
@OverRide
public void onSuccess() {
Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
}
}, new Realm.Transaction.OnError() {
@OverRide
public void onError(Throwable error) {
Toast.makeText(getApplicationContext(), "There was an error"+error.toString(), Toast.LENGTH_SHORT).show();
Log.d("kuchbhe", error.toString());
}
});
some other code...
Error:(12, 8) error: Field "meraarray" of type "java.lang.String[]" is not supported.Warning:Unclosed files for the types '[io.realm.RealmModelRealmProxy]'; these types will not undergo annotation processing
The text was updated successfully, but these errors were encountered: