Search in sources :

Example 1 with ContentItem

use of com.xxmassdeveloper.mpchartexample.notimportant.ContentItem in project MPAndroidChart by PhilJay.

the class RealmMainActivity method onCreate.

@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();
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) ListView(android.widget.ListView) ArrayList(java.util.ArrayList) MyAdapter(com.xxmassdeveloper.mpchartexample.notimportant.MyAdapter) Realm(io.realm.Realm) ContentItem(com.xxmassdeveloper.mpchartexample.notimportant.ContentItem)

Aggregations

ListView (android.widget.ListView)1 ContentItem (com.xxmassdeveloper.mpchartexample.notimportant.ContentItem)1 MyAdapter (com.xxmassdeveloper.mpchartexample.notimportant.MyAdapter)1 Realm (io.realm.Realm)1 RealmConfiguration (io.realm.RealmConfiguration)1 ArrayList (java.util.ArrayList)1