我正在使用较新的RX java而不是
Observable.create(new Observable.OnSubscribeFunc<T>() {...});
Run Code Online (Sandbox Code Playgroud)
使用:(由于弃用)
Observable.create(new Observable.OnSubscribe<T>() {...});
Run Code Online (Sandbox Code Playgroud)
(这可能很重要,因为大多数示例,教程,explonation使用旧的......)
好吧,让我们看看我的问题.我有一个Java类,相关部分来自它:
private interface ApiManagerService {
@FormUrlEncoded
@POST("/login")
User getUser(@Field("username") String userName, @Field("password") String password);
}
private static RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(HOST)
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
private static ApiManagerService apiManager = restAdapter.create(ApiManagerService.class);
public static Subscription login(final String userName, final String password, Observer<User> observer) {
return Observable.create(new Observable.OnSubscribe<User>() {
@Override
public void call(Subscriber<? super User> subscriber) {
try {
User user = apiManager.getUser(userName, password);
subscriber.onNext(user);
subscriber.onCompleted();
} catch (RetrofitError e) {
subscriber.onError(e); …Run Code Online (Sandbox Code Playgroud) 我有一节课:
@Table(name = "Control")
public class Control extends Model{
@Column
private String name;
[...]
@Column
private Map<String, Object> properties;
}
Run Code Online (Sandbox Code Playgroud)
我在这堂课中有其他领域,但我在这里只写了那些足以表明我的问题的东西.
我有一个关于插入的例外:
09-14 22:11:34.542: E/SQLiteLog(11482): (1) table Control has no column named properties
Run Code Online (Sandbox Code Playgroud)
对象可以是String []或String.
如果我不将@Column放在HashMap数据上,那么一切都"好",只有它们没有存储的问题.
所以我的问题是如何解决存储这个hashmap的问题.
我的数据来自API,它总是具有相同的属性:
controls: [
{
bundle: "CloseButton",
frame: "0,0,25,25"
},
{
referenceKey: "AccelerationGyro",
name: "Acceleration Sensor",
bundle: "Gyro",
properties: {
axis: "Z"
observedKey: "brakeState",
requiedValue: "1"
},
channels: {
CH: "Acceleration"
}
},
{
referenceKey: "SteeringGyro",
name: "Steering Sensor",
bundle: "Gyro",
properties: {
axis: …Run Code Online (Sandbox Code Playgroud)