当前位置: 首页>>代码示例>>Java>>正文


Java Realm.deleteAll方法代码示例

本文整理汇总了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();
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:9,代码来源:Media.java

示例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;
}
 
开发者ID:LDLN,项目名称:Responder-Android,代码行数:17,代码来源:LDLN.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:RealmMainActivity.java


注:本文中的io.realm.Realm.deleteAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。