我使用ormLite在设备上存储数据.我无法理解为什么但是当我存储大约100个对象时,其中一些存储时间太长,直到第二个.这是代码
来自DatabaseManager:
public class DatabaseManager
public void addSomeObject(SomeObject object) {
try {
getHelper().getSomeObjectDao().create(object);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public class DatabaseHelper extends OrmLiteSqliteOpenHelper
public Dao<SomeObject, Integer> getSomeObjectDao() {
if (null == someObjectDao) {
try {
someObjectDao = getDao(SomeObject.class);
} catch (Exception e) {
e.printStackTrace();
}
}
return someObjectDao;
}
Run Code Online (Sandbox Code Playgroud)
有什么想法可以避免这种情况?
我在 git 上加载了一些包含一些个人数据的项目。现在我更改了所有行并提交。现在我需要删除除最后一个之外的所有提交,以防止丢失个人数据。
尝试从ActionBarSherlock开始.下载库.设置ADT与上次更新,SDK相同.
尝试进行简单的活动:
import com.actionbarsherlock.app.SherlockActivity;
import android.os.Bundle;
public class MainActivity extends SherlockActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Run Code Online (Sandbox Code Playgroud)
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.alxr.usingsherlocksample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Sherlock.__Theme" >
<activity
android:name="ru.alxr.usingsherlocksample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
ADT不允许用红色x设置android:theme ="@ style/Sherlock".
所以,我在logcat中遇到了exxcted错误:
03-23 21:25:54.437: E/AndroidRuntime(13145): FATAL EXCEPTION: main
03-23 21:25:54.437: E/AndroidRuntime(13145): java.lang.RuntimeException: Unable to start activity ComponentInfo{ru.alxr.usingsherlocksample/ru.alxr.usingsherlocksample.MainActivity}: java.lang.IllegalStateException: You must use Theme.Sherlock, …Run Code Online (Sandbox Code Playgroud) 我正在尝试在数据库中设置记录创建的时间戳
例如:我 POST(通过 Firebase 实时数据库 REST API)对象
{"name": "Name", "last_name": "LastName" }
Run Code Online (Sandbox Code Playgroud)
然后我可以在控制台中看到:
{"name": "Name", "last_name": "LastName", "time_stamp": 1563371542446 }
Run Code Online (Sandbox Code Playgroud)