本文整理汇总了Java中io.realm.Realm.deleteAll方法的典型用法代码示例。如果您正苦于以下问题:Java Realm.deleteAll方法的具体用法?Java Realm.deleteAll怎么用?Java Realm.deleteAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.realm.Realm
的用法示例。
在下文中一共展示了Realm.deleteAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidate
import io.realm.Realm; //导入方法依赖的package包/类
public static void invalidate() {
Log.e(Util.LOG_TAG, "Invalidate called, all caches will be wiped");
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.deleteAll();
realm.commitTransaction();
realm.close();
}
示例2: logout
import io.realm.Realm; //导入方法依赖的package包/类
/**
* Logs the user out of their current session.
*/
public static void logout(Context context)
{
// Destroy USER database
Realm realm = Realm.getInstance(getRealmConfig(context, RealmLevel.USER));
realm.beginTransaction();
realm.deleteAll();
realm.commitTransaction();
// Clear "session"
USER = null;
USERNAME = null;
DEK = null;
}
示例3: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
setTitle("Realm.io Examples");
ArrayList<ContentItem> objects = new ArrayList<ContentItem>();
objects.add(new ContentItem("Line Chart", "Creating a LineChart with Realm.io database"));
objects.add(new ContentItem("Bar Chart",
"Creating a BarChart with Realm.io database"));
objects.add(new ContentItem("Horizontal Bar Chart",
"Creating a HorizontalBarChart with Realm.io database"));
objects.add(new ContentItem("Scatter Chart",
"Creating a ScatterChart with Realm.io database"));
objects.add(new ContentItem("Candle Stick Chart", "Creating a CandleStickChart with Realm.io database"));
objects.add(new ContentItem("Bubble Chart", "Creating a BubbleChart with Realm.io database"));
objects.add(new ContentItem("Pie Chart", "Creating a PieChart with Realm.io database"));
objects.add(new ContentItem("Radar Chart", "Creating a RadarChart with Realm.io database"));
objects.add(new ContentItem("Realm Wiki", "This is the code related to the wiki entry about realm.io on the MPAndroidChart github page."));
MyAdapter adapter = new MyAdapter(this, objects);
ListView lv = (ListView) findViewById(R.id.listView1);
lv.setAdapter(adapter);
lv.setOnItemClickListener(this);
Realm.init(this);
// Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
RealmConfiguration realmConfig = new RealmConfiguration.Builder().build();
Realm.setDefaultConfiguration(realmConfig);
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.deleteAll();
realm.commitTransaction();
}