小编App*_*oid的帖子

SQlite数据库以编程方式在Android中转换为Excel文件格式

我正在开发Android应用程序,其中SQlite作为数据库.我想以编程方式将我的Android应用程序数据库导出为ex​​cel文件格式,以便普通人可以轻松地读取他们的数据库.如果有可能请给我提示或不提示帮助我转换任何其他文件格式,如文本文件或其他.谢谢投票......

sqlite android file-conversion

6
推荐指数
1
解决办法
1万
查看次数

通过Retrofit 2将数据存储到Realm中

我是Realm集成的新手。我正在尝试将翻新的json响应保存到Realm数据库中。但我仍然困惑如何完成此任务以进行改装2。

我收到json响应,并根据RealM文档扩展了RealmObject类。但仍然没有获得将我的回应直接存储到领域中的好方法。

仪表板活动:

  apiInterface = APIClient.getClient().create(APIInterface.class);
        final Call<RealmList<ExampleTest>> call = apiInterface.getSurvay();
    call.enqueue(new Callback<RealmList<ExampleTest>>() {
        @Override
        public void onResponse(Call<RealmList<ExampleTest>> call, Response<RealmList<ExampleTest>> response) {   

    resource = response.body();

Log.d(" response "," success ");

            }
Run Code Online (Sandbox Code Playgroud)

API客户端:

{ 
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();


retrofit = new Retrofit.Builder()
        .baseUrl("** my URL **")
        .addConverterFactory(GsonConverterFactory.create())
        .client(client)
        .build();


return retrofit;
}
Run Code Online (Sandbox Code Playgroud)

build.gradle:

compile ('com.squareup.retrofit2:retrofit:2.1.0') {
        exclude module: 'okhttp'
    }
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
Run Code Online (Sandbox Code Playgroud)

POJO类:

示例测试:

public class ExampleTest extends …
Run Code Online (Sandbox Code Playgroud)

database json realm gson retrofit2

1
推荐指数
1
解决办法
2959
查看次数

标签 统计

android ×1

database ×1

file-conversion ×1

gson ×1

json ×1

realm ×1

retrofit2 ×1

sqlite ×1