G
Gameraco
Neues Mitglied
- 0
Hallo,
schon mal danke an alle Helfer
Ich finde meinen Fehler einfach nicht.
Die App besteht aus 5 Klassen:
-Splash(wird nur kurz am Anfang der App angezeigt)
-Neues Gebiet(das ist die MainActivity(habs am Anfang falsch benannt)
-DBAdapter(für SQLite)
-Gebiet(die Klasse für DBAdapter mit get/setid, get/setname)
-GebAdd(eine Klasse mit der man neue Gebiete der Datenbank hinzufügen kann)
Immer wenn ich die App auf meinem Handy ausführe, stürzt sie nach dem Splash ab.
Eclipse bringt keine Fehler, und das ist der Logcat Eintrag:
Hier ist noch der Code der Klassen:
-Splash:
-Neues Gebiet
-DBAdapter:
-Gebiet:
-GebAdd:
Und hier noch die Manifest.xml:
Schon mal vielen dank für die Antworten.
Ich hoffe ihr findet den Fehler, ich sitze schon ein paar tagen darüber.
LG Gameraco
schon mal danke an alle Helfer
Ich finde meinen Fehler einfach nicht.
Die App besteht aus 5 Klassen:
-Splash(wird nur kurz am Anfang der App angezeigt)
-Neues Gebiet(das ist die MainActivity(habs am Anfang falsch benannt)
-DBAdapter(für SQLite)
-Gebiet(die Klasse für DBAdapter mit get/setid, get/setname)
-GebAdd(eine Klasse mit der man neue Gebiete der Datenbank hinzufügen kann)
Immer wenn ich die App auf meinem Handy ausführe, stürzt sie nach dem Splash ab.
Eclipse bringt keine Fehler, und das ist der Logcat Eintrag:
02-22 17:47:25.555: E/HwSystemManager(3414): AppCleanUpService:msg is 0
02-22 17:47:25.720: E/Thermal-daemon(2427): [flash_led] temp_new :27 temp_old :26
02-22 17:47:25.720: E/Thermal-daemon(2427): [ap] temp_new :30 temp_old :28
02-22 17:47:26.060: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.065: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.080: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.085: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.705: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.715: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.955: E/AuthorizationBluetoothService(30173): Proximity feature is not enabled.
02-22 17:47:32.630: E/HwLauncher(3276): Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
02-22 17:47:32.640: E/KeyguardHostView(3027): KeyguardHostView()
02-22 17:47:32.685: E/AudioFlinger(2423): setLppDtsGeq():invalid keyValue of dts geq.
02-22 17:47:32.845: E/AbsClockView(3027): In setFactory...
02-22 17:47:32.845: E/HwClockView(3027): In HwClockView...
02-22 17:47:33.085: E/HwLauncher(3276): Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
02-22 17:47:25.720: E/Thermal-daemon(2427): [flash_led] temp_new :27 temp_old :26
02-22 17:47:25.720: E/Thermal-daemon(2427): [ap] temp_new :30 temp_old :28
02-22 17:47:26.060: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.065: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.080: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.085: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.705: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.715: E/cutils(2414): Failed to mkdirat(/storage/sdcard1/Android): Read-only file system
02-22 17:47:26.955: E/AuthorizationBluetoothService(30173): Proximity feature is not enabled.
02-22 17:47:32.630: E/HwLauncher(3276): Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
02-22 17:47:32.640: E/KeyguardHostView(3027): KeyguardHostView()
02-22 17:47:32.685: E/AudioFlinger(2423): setLppDtsGeq():invalid keyValue of dts geq.
02-22 17:47:32.845: E/AbsClockView(3027): In setFactory...
02-22 17:47:32.845: E/HwClockView(3027): In HwClockView...
02-22 17:47:33.085: E/HwLauncher(3276): Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
Hier ist noch der Code der Klassen:
-Splash:
Code:
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try { Thread.sleep(2500);
}catch (InterruptedException e) {
e.printStackTrace();
}finally{
Intent Weiterleitung = new Intent("android.intent.action.MAINACT");
startActivity(Weiterleitung);
};
}
};
timer.start();
}
}
Code:
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import java.util.List;
import android.view.Menu;
import android.view.MenuInflater;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class NeuesGebiet<T> extends ListActivity {
ListView list;
private DBAdapter db;
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new DBAdapter(this);
db.open();
List<Gebiet> gebiete = db.getAllGebiet();
list = (ListView)findViewById(R.id.list);
registerForContextMenu(getListView());
ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, gebiete);
list.setAdapter((adapter));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
@Override
protected void onResume(){
db.open();
super.onResume();
}
@Override
protected void onPause(){
db.close();
super.onPause();
}
}
Code:
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class DBAdapter {
public static final String KEY_ROWID = "kunde_id";
public static final String KEY_NAME = "name";
private static final String TAG = "DBHelper";
private static final String DATABASE_NAME = "gebiete.db";
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_TABLE = "GListe";
private static final String DATABASE_CREATE = "create table "
+ DATABASE_TABLE +"(" + KEY_ROWID
+" integer primary key autoincrement, " +KEY_NAME
+" varchar(255);";
private final Context context;
private DatabaseHelper DBHelper;
private SQLiteDatabase db;
public DBAdapter(Context ctx)
{
this.context = ctx;
DBHelper = new DatabaseHelper(context);
}
private static class DatabaseHelper extends SQLiteOpenHelper{
DatabaseHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion,
int newVersion)
{
Log.w(TAG, "Upgrading database from version " + oldVersion
+ " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS titles");
onCreate(db);
}
}
public DBAdapter open() throws SQLException
{
db = DBHelper.getWritableDatabase();
return this;
}
public void close()
{
DBHelper.close();
}
public long insertGebiet(String name)
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_NAME, name);
return db.insert(DATABASE_TABLE, null, initialValues);
}
public boolean deleteGebiet(long rowId)
{
return db.delete(DATABASE_TABLE, KEY_ROWID +
"=" + rowId, null) > 0;
}
public List<Gebiet> getAllGebiet()
{
List<Gebiet> Gebiete = new ArrayList<Gebiet>();
Cursor cursor = db.query(DATABASE_TABLE, new String[] {
KEY_ROWID,
KEY_NAME
},
null,
null,
null,
null,
KEY_NAME);
cursor.moveToFirst();
while(!cursor.isAfterLast()){
Gebiet gebiet = cursortogebiet(cursor);
Gebiete.add(gebiet);
cursor.moveToNext();
}
cursor.close();
return Gebiete;
}
private Gebiet cursortogebiet(Cursor c){
Gebiet gebiet = new Gebiet();
gebiet.setGebietId(c.getInt(0));
gebiet.setName(c.getString(1));
return gebiet;
}
public Cursor getGebiet(long rowId) throws SQLException
{
Cursor mCursor =
db.query(true, DATABASE_TABLE, new String[] {
KEY_ROWID,
KEY_NAME},
KEY_ROWID + "=" + rowId,
null,
null,
null,
null,
null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
public boolean updateGebiet(long rowId, String name)
{
ContentValues args = new ContentValues();
args.put(KEY_NAME, name);
return db.update(DATABASE_TABLE, args,
KEY_ROWID + "=" + rowId, null) > 0;
}
}
Code:
public class Gebiet {
private long id;
private String name;
public long getGebietId() {
return id;
}
public void setGebietId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString(){
return name;
}
}
Code:
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class GebAdd extends Activity{
Button neuesgebiet;
EditText tname;
DBAdapter db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.neuesgebiet);
db = new DBAdapter(getBaseContext());
db.open();
tname = (EditText)findViewById(R.id.tname);
neuesgebiet = (Button)findViewById(R.id.ok);
neuesgebiet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!tname.getText().toString().equals("") )
{
long kunde_id = db.insertGebiet(tname.getText().toString());
Intent intent = new Intent(GebAdd.this, null);
intent.putExtra("id", String.valueOf(kunde_id));
startActivity(intent);
Toast.makeText(getBaseContext(), "Daten gespeichert", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getBaseContext(), "Fehler: Es wurden nicht alle Felder ausgefüllt!", Toast.LENGTH_LONG).show();
}
}
});
}
protected void onClose() {
db.close();
}
}
Und hier noch die Manifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.marcoa.writeitdown"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NeuesGebiet"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAINACT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".GebAdd"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.GEBADD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Schon mal vielen dank für die Antworten.
Ich hoffe ihr findet den Fehler, ich sitze schon ein paar tagen darüber.
LG Gameraco