我试图从firebase时间戳获取日期和时间,如下所示:
Date date=new Date(timestamp*1000);
SimpleDateFormat sfd = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
sfd.format(date)
Run Code Online (Sandbox Code Playgroud)
但我得到的结果如下:
:02-02-48450 04:21:54
:06-02-48450 10:09:45
:07-02-48450 00:48:35
Run Code Online (Sandbox Code Playgroud)
你可以看到这一年不是我们的生活.
所以,请帮我解决这个问题.
在我的应用程序中,我使用 MPAndroidChart 需要饼图,但是在 Piedata 构造函数中添加数据时出错,请帮助。使用依赖编译 'com.github.PhilJay:MPAndroidChart:v3.0.0 beta'
imageView=(PieChart) v.findViewById(R.id.result_text);
ArrayList<Entry> entries = new ArrayList<>();
entries.add(new Entry(4f, 0));
entries.add(new Entry(8f, 1));
entries.add(new Entry(6f, 2));
entries.add(new Entry(12f, 3));
entries.add(new Entry(18f, 4));
entries.add(new Entry(9f, 5));
PieDataSet dataset = new PieDataSet(entries,"uyggh");
ArrayList<Object> labels = new ArrayList<Object>();
labels.add("January");
labels.add("February");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
PieData data = new PieData(labels, dataset);//getting error here
imageView.setData(data);
imageView.setDescription("Description");
Run Code Online (Sandbox Code Playgroud) 我正在使用对象框版本1.1.0.使用ObjectBox文档中给出的说明进行安装,但收到此错误.即使我在Objectbox的FAQ部分搜索了这个问题,他们提供的解决方案是删除android-apt.但是在gradle文件中没有使用android-apt.那么,如何克服这个问题请帮助我.Bellow是我的根级gradle文件
buildscript {
ext {
_buildToolsVersion = '26.0.1'
_compileSdkVersion = 26
objectboxVersion = '1.1.0'
}
repositories {
jcenter()
mavenCentral()
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
}
}allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven { url "http://objectbox.net/beta-repo/"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
app gradle文件如下
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.kingof.android"
minSdkVersion 16
targetSdkVersion 25
versionCode 3
versionName …Run Code Online (Sandbox Code Playgroud)