Skip to content
Snippets Groups Projects
Commit 481779e5 authored by Christian Dresen's avatar Christian Dresen
Browse files

SQLite added

parent 668d9ac9
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,7 @@
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="activeandroid-3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
......
File added
......@@ -6,7 +6,15 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name="ms.itsecteam.warpdrink.WarpDrinkApplication"
android:theme="@style/AppTheme" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<meta-data android:name="AA_DB_NAME" android:value="warpdrink_data.db" />
<meta-data android:name="AA_DB_VERSION" android:value="5" />
<meta-data
android:name="AA_MODELS"
android:value="ms.itsecteam.warpdrink.data.User" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
......
......@@ -2,11 +2,15 @@ package ms.itsecteam.warpdrink;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import ms.itsecteam.warpdrink.data.User;
import ms.itsecteam.warpdrink.orderList.ListViewAdapter;
......@@ -47,6 +51,7 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
this.lstAdapter = new ListViewAdapter(this, R.layout.order_list_item, new ArrayList<Order>());
this.lstOrdered.setAdapter(this.lstAdapter);
}
public void removeOrderOnClickHandler(View v) {
......
package ms.itsecteam.warpdrink;
import android.util.Log;
import com.activeandroid.ActiveAndroid;
/**
* Created by Chris on 26.06.2015.
*/
public class WarpDrinkApplication extends com.activeandroid.app.Application {
@Override
public void onCreate() {
super.onCreate();
Log.d("DATABASE", "INIT");
ActiveAndroid.initialize(this);
}
}
package ms.itsecteam.warpdrink.data;
/**
* Created by Chris on 26.06.2015.
*/
public class User {
private int id;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;
import java.util.List;
@Table(name = "Users")
public class User extends Model {
@Column(name = "userid")
private int userid;
@Column(name = "name")
private String name;
@Column(name = "credit")
private double credit;
public User() {
super();
}
public User(int userid, String name, double credit) {
super();
this.userid = userid;
this.name = name;
this.credit = credit;
}
public String getName() {
return name;
}
......@@ -23,4 +43,13 @@ public class User {
public void setCredit(double credit) {
this.credit = credit;
}
public static List<User> getAll() {
return new Select()
.from(User.class)
.execute();
}
public String toString() {
return "[Name: "+this.name+", Credit:"+this.credit+"]";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment