當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。