1. Mitglieder surfen ohne Werbung auf Android-Hilfe.de! ✔ Jetzt kostenlos Mitglied in unserer Community werden.
  1. paxis, 26.03.2013 #1
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Hallo Leute,

    ich bin gerade dabei mich in SQL einzuarbeiten und wollte eine kleine ToDoList App schreiben:rolleyes2:!
    Jetzt erstmal mein Code:


    hauptklasse:
    Code:
    package de.tobitodolist;
    
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.util.List;
    
    import de.tobitodolist.R.id;
    
    import android.R.string;
    import android.os.Bundle;
    import android.app.Activity;
    import android.database.Cursor;
    import android.text.Editable;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ListView;
    import android.widget.SimpleCursorAdapter;
    import android.widget.TextView;
    
    public class MainActivity<tobi> extends Activity {
        private DBZugriff dbZugriff;
        private ListView anzeigeListe;
        private SimpleCursorAdapter adapter;
        private Cursor cursor;
        private String tobi;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            Button button = (Button) this.findViewById(R.id.button1);
            button.setOnClickListener((OnClickListener) this);
            dbZugriff = new DBZugriff(null, null);
            EditText test2 = (EditText) this.findViewById(R.id.editText1);
            tobi = test2.toString();
            
        }
        public void onClick(View v) {
            switch(v.getId()) {
               case R.id.button1  :
                   Aufgabe test = new Aufgabe(tobi,1);
                   dbZugriff.datensatzEinfügen(test);
               case R.id.button2 :
                   TextView test3 = (TextView) this.findViewById(R.id.textView1);
                    List<Aufgabe> test5 = dbZugriff.gibAlle();
                   
                   test3.setText(getString(test5));
            }
            
        }
    
    
        private CharSequence getString(List<Aufgabe> test5) {
            // TODO Auto-generated method stub
            return null;
        }
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
        
    }
    
        
    SQKlasse:
    package de.tobitodolist;

    import java.util.ArrayList;
    import java.util.List;

    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;
    import android.util.Log;

    public class DBZugriff extends SQLiteOpenHelper{

    private SQLiteDatabase db;
    private String tabelle;

    public DBZugriff(Context activity, String dbName) {
    super(activity, dbName, null, 1);
    db = getWritableDatabase();

    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub
    try{
    String sql = "CREATE TABLE aufgaben" +
    "(id INTEGER PRIMARY JEY AUTONINCREMENT," +
    "aufgabe string " +
    "priorität int)";
    db.execSQL(sql);
    }
    catch(Exception ex) {
    Log.e("Test", ex.getMessage());
    }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

    }
    public synchronized void close() {
    if(db != null){
    db.close();
    db = null;
    }
    super.close();
    }

    public Aufgabe erstellen(Cursor cursor) {
    Aufgabe af = new Aufgabe(tabelle, 0);
    af.id = cursor.getLong(0);
    af.aufgabe = cursor.getString(0);
    af.priorität = cursor.FIELD_TYPE_INTEGER;

    return af;

    }
    public long datensatzEinfügen(Aufgabe af) {
    try {
    ContentValues daten = erzeugeDatenObjekt(af);
    return db.insert(tabelle, null, daten); // id wird automatisch von SQLite gefüllt
    }
    catch(Exception ex) {
    Log.d("carpelibrum", ex.getMessage());
    return -1;
    }
    }



    private ContentValues erzeugeDatenObjekt(Aufgabe af) {
    // TODO Auto-generated method stub
    return null;
    }

    public void loeschen(Aufgabe af) {
    db.delete("freunde", "id" + af.id, null);
    }

    public List<Aufgabe> gibAlle(){
    List<Aufgabe> ergebnis = new ArrayList<Aufgabe>();
    Cursor cursor = null;

    try {

    cursor = db.query(tabelle, null, null, null, null, null, null);
    int anzahl = cursor.getCount();
    cursor.moveToFirst();

    for(int i = 0; i < anzahl; i++) {
    Aufgabe ds = erstellen(cursor);
    ergebnis.add(ds);
    cursor.moveToNext();
    }
    }
    catch(Exception ex) {
    Log.e("carpelibrum", ex.getMessage());
    }
    finally {
    // egal ob Erfolg oder Exception:: cursor schließen
    if(cursor != null && !cursor.isClosed()) {
    cursor.close();
    }

    }
    return ergebnis; }

    }

    Klasse Aufgabe:
    Code:
    package de.tobitodolist;
    
    public class Aufgabe {
        public long id;  
        public String aufgabe;
        public int priorität;
        
        public Aufgabe(String aufgabe, int priorität) {
        
        this.aufgabe = aufgabe;
        
        id= -1;
    }}
    
    
    
    Und die XML Datei:
    Code:
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >
    
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="27dp"
            android:layout_marginTop="26dp"
            android:text="Button" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/button1"
            android:layout_marginLeft="60dp"
            android:layout_toRightOf="@+id/button1"
            android:text="TextView" />
    
        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/button1"
            android:layout_below="@+id/button1"
            android:layout_marginTop="19dp"
            android:ems="10" >
    
            <requestFocus />
        </EditText>
    
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/button1"
            android:layout_below="@+id/editText1"
            android:layout_marginTop="16dp"
            android:text="Button" />
    
    </RelativeLayout>

    Zur Info, habe mich an meinem Lehrbuch orientiert :)!
    Folgendes Problem tritt auf:
    Wenn ich die APP im emulator starten will, komtm nichts nur die Meldung das er sich unerwartet beendet hat! :(

    Wäre super wenn mir hier jemand helfen könnte oder vlt. auf ein anderes Forum verweisen könnte, wo vlt. mehr entwicklter unterwegs sind!

    danke schonmal :)))

    paxis
     
    Zuletzt bearbeitet: 26.03.2013
  2. StefMa, 26.03.2013 #2
    StefMa

    StefMa Gewerbliches Mitglied

    [​IMG]
     
    blackfire185 gefällt das.
  3. paxis, 26.03.2013 #3
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Das sind die Fehlermeldungen im Debugger die kommen:
    03-26 14:32:40.922: W/ActivityManager(289): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
    03-26 14:32:40.942: E/ActivityThread(648): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5df80 that was originally bound here
    03-26 14:32:40.942: E/ActivityThread(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5df80 that was originally bound here
    03-26 14:32:40.942: E/ActivityThread(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:32:40.942: E/ActivityThread(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:32:40.942: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:32:40.942: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:32:40.942: E/ActivityThread(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:32:40.942: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:32:40.942: E/ActivityThread(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:32:40.942: E/ActivityThread(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:32:40.942: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:32:40.942: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:32:40.942: E/ActivityThread(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:32:40.953: E/StrictMode(648): null
    03-26 14:32:40.953: E/StrictMode(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5df80 that was originally bound here
    03-26 14:32:40.953: E/StrictMode(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:32:40.953: E/StrictMode(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:32:40.953: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:32:40.953: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:32:40.953: E/StrictMode(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:32:40.953: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:32:40.953: E/StrictMode(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:32:40.953: E/StrictMode(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:32:40.953: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:32:40.953: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:32:40.953: E/StrictMode(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:32:40.962: W/ActivityManager(289): Unbind failed: could not find connection for android.os.BinderProxy@41020730
    03-26 14:32:40.982: E/ActivityThread(648): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf9050 that was originally bound here
    03-26 14:32:40.982: E/ActivityThread(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf9050 that was originally bound here
    03-26 14:32:40.982: E/ActivityThread(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:32:40.982: E/ActivityThread(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:32:40.982: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:32:40.982: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:32:40.982: E/ActivityThread(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:32:40.982: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:32:40.982: E/ActivityThread(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:32:40.982: E/ActivityThread(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:32:40.982: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:32:40.982: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:32:40.982: E/ActivityThread(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:32:41.012: E/StrictMode(648): null
    03-26 14:32:41.012: E/StrictMode(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf9050 that was originally bound here
    03-26 14:32:41.012: E/StrictMode(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:32:41.012: E/StrictMode(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:32:41.012: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:32:41.012: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:32:41.012: E/StrictMode(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:32:41.012: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:32:41.012: E/StrictMode(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:32:41.012: E/StrictMode(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:32:41.012: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:32:41.012: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:32:41.012: E/StrictMode(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:32:41.012: W/ActivityManager(289): Unbind failed: could not find connection for android.os.BinderProxy@410c4960
    03-26 14:33:25.966: D/ExchangeService(648): Received deviceId from Email app: null
    03-26 14:33:25.966: D/ExchangeService(648): !!! deviceId unknown; stopping self and retrying
    03-26 14:33:31.002: D/ExchangeService(648): !!! EAS ExchangeService, onCreate
    03-26 14:33:31.032: D/ExchangeService(648): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
    03-26 14:33:31.042: D/ExchangeService(648): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
    03-26 14:33:31.062: W/ActivityManager(289): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
    03-26 14:33:31.062: D/ExchangeService(648): !!! Email application not found; stopping self
    03-26 14:33:31.083: W/ActivityManager(289): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
    03-26 14:33:31.122: E/ActivityThread(648): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d287c0 that was originally bound here
    03-26 14:33:31.122: E/ActivityThread(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d287c0 that was originally bound here
    03-26 14:33:31.122: E/ActivityThread(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:33:31.122: E/ActivityThread(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:33:31.122: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:33:31.122: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:33:31.122: E/ActivityThread(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:33:31.122: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:33:31.122: E/ActivityThread(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:33:31.122: E/ActivityThread(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:33:31.122: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:33:31.122: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:33:31.122: E/ActivityThread(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:33:31.222: E/StrictMode(648): null
    03-26 14:33:31.222: E/StrictMode(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d287c0 that was originally bound here
    03-26 14:33:31.222: E/StrictMode(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:33:31.222: E/StrictMode(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:33:31.222: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:33:31.222: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:33:31.222: E/StrictMode(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:33:31.222: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:33:31.222: E/StrictMode(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:33:31.222: E/StrictMode(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:33:31.222: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:33:31.222: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:33:31.222: E/StrictMode(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:33:31.252: W/ActivityManager(289): Unbind failed: could not find connection for android.os.BinderProxy@41085c78
    03-26 14:33:31.272: E/ActivityThread(648): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d283c8 that was originally bound here
    03-26 14:33:31.272: E/ActivityThread(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d283c8 that was originally bound here
    03-26 14:33:31.272: E/ActivityThread(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:33:31.272: E/ActivityThread(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:33:31.272: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:33:31.272: E/ActivityThread(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:33:31.272: E/ActivityThread(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:33:31.272: E/ActivityThread(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:33:31.272: E/ActivityThread(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:33:31.272: E/ActivityThread(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:33:31.272: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:33:31.272: E/ActivityThread(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:33:31.272: E/ActivityThread(648): at java.lang.Thread.run(Thread.java:856)
    03-26 14:33:31.371: E/StrictMode(648): null
    03-26 14:33:31.371: E/StrictMode(648): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d283c8 that was originally bound here
    03-26 14:33:31.371: E/StrictMode(648): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    03-26 14:33:31.371: E/StrictMode(648): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    03-26 14:33:31.371: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    03-26 14:33:31.371: E/StrictMode(648): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    03-26 14:33:31.371: E/StrictMode(648): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    03-26 14:33:31.371: E/StrictMode(648): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    03-26 14:33:31.371: E/StrictMode(648): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    03-26 14:33:31.371: E/StrictMode(648): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    03-26 14:33:31.371: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    03-26 14:33:31.371: E/StrictMode(648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    03-26 14:33:31.371: E/StrictMode(648): at java.lang.Thread.run(Thread.java:856)
     
  4. deek, 26.03.2013 #4
    deek

    deek Android-Experte

    Die Fehlermeldung hat so rein optisch nichts mit deiner App zu tun. Kannst du in der Logcat View in Eclipse die Ausgabe bitte auf deine App einschränken und dann nochmal schauen wo es knallt?
     
  5. paxis, 26.03.2013 #5
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Fehlercode:
    03-26 14:22:10.022: E/AndroidRuntime(796): FATAL EXCEPTION: main
    03-26 14:22:10.022: E/AndroidRuntime(796): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.tobitodolist/de.tobitodolist.MainActivity}: java.lang.ClassCastException: de.tobitodolist.MainActivity cannot be cast to android.view.View$OnClickListener
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread.access$600(ActivityThread.java:141)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.os.Looper.loop(Looper.java:137)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread.main(ActivityThread.java:5041)
    03-26 14:22:10.022: E/AndroidRuntime(796): at java.lang.reflect.Method.invokeNative(Native Method)
    03-26 14:22:10.022: E/AndroidRuntime(796): at java.lang.reflect.Method.invoke(Method.java:511)
    03-26 14:22:10.022: E/AndroidRuntime(796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    03-26 14:22:10.022: E/AndroidRuntime(796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    03-26 14:22:10.022: E/AndroidRuntime(796): at dalvik.system.NativeStart.main(Native Method)
    03-26 14:22:10.022: E/AndroidRuntime(796): Caused by: java.lang.ClassCastException: de.tobitodolist.MainActivity cannot be cast to android.view.View$OnClickListener
    03-26 14:22:10.022: E/AndroidRuntime(796): at de.tobitodolist.MainActivity.onCreate(MainActivity.java:34)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.Activity.performCreate(Activity.java:5104)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    03-26 14:22:10.022: E/AndroidRuntime(796): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
    03-26 14:22:10.022: E/AndroidRuntime(796): ... 11 more
     
  6. deek, 26.03.2013 #6
    deek

    deek Android-Experte

    Du definierst zwar die OnClick Methode, aber deine Klasse implementiert nicht das entsprechende Inferface:

    Code:
    public class MainActivity extends Activity implements View.OnclickListener {
    
     
  7. paxis, 26.03.2013 #7
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Wie dämlich muss man eigentlich sein? *kopf gegen wand*
    Ja danke :)!
    Jetzt kann ich den rest anpassen :D
     
  8. paxis, 26.03.2013 #8
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Kann mir einer verraten, warum er mir nichts anzeigt?
    Wo ist mein Denkfehler? :D

    Also hier die die OnClick:
    public void onClick(View v) {
    switch(v.getId()) {
    case R.id.button1 :
    EditText test2 = (EditText) this.findViewById(R.id.editText1);
    tobi = test2.toString();
    Aufgabe test = new Aufgabe(tobi,1);
    dbZugriff.datensatzEinfügen(test);
    case R.id.button2 :


    TextView test3 = (TextView) this.findViewById(R.id.textView1);
    List<Aufgabe> test5;

    test5 = dbZugriff.gibAlle();
    test3.setText(getString(test5));

    }

    Wenn ich auf Button 2 clicke, soll er mir die Klasse im Textfeld ausgeben, da kommt aber nichts.

    Die Methode gibAll ist so:


    public List<Aufgabe> gibAlle(){
    List<Aufgabe> ergebnis = new ArrayList<Aufgabe>();
    Cursor cursor = null;

    try {

    cursor = db.query(tabelle, null, null, null, null, null, null);
    int anzahl = cursor.getCount();
    cursor.moveToFirst();

    for(int i = 0; i < anzahl; i++) {
    Aufgabe af = erstellen(cursor);
    ergebnis.add(af);
    cursor.moveToNext();
    }
    }
    catch(Exception ex) {
    Log.e("carpelibrum", ex.getMessage());
    }
    finally {
    // egal ob Erfolg oder Exception:: cursor schließen
    if(cursor != null && !cursor.isClosed()) {
    cursor.close();
    }

    }
    return ergebnis; }

    }
     
  9. deek, 26.03.2013 #9
    deek

    deek Android-Experte

    Wenn die onCreate der Activity noch wie im Ausgangspost definiert ist, dann setzt du auf dem Button2 keinen OnClickListener...
     
  10. paxis, 26.03.2013 #10
    paxis

    paxis Threadstarter Android-Hilfe.de Mitglied

    Ne:
    setContentView(R.layout.activity_main);
    Button button1 = (Button) this.findViewById(R.id.button1);
    button1.setOnClickListener((OnClickListener) this);
    Button button2 = (Button) this.findViewById(R.id.button2);
    button2.setOnClickListener((OnClickListener)this);
    dbZugriff = new DBZugriff(null, null);


    }
    public void onClick(View v) {
    switch(v.getId()) {
    case R.id.button1 :
    EditText test2 = (EditText) this.findViewById(R.id.editText1);
    tobi = test2.toString();
    Aufgabe test = new Aufgabe(tobi,1);
    dbZugriff.datensatzEinfügen(test);
    case R.id.button2 :


    TextView test3 = (TextView) this.findViewById(R.id.textView1);
    List<Aufgabe> test5;

    test5 = dbZugriff.gibAlle();
    test3.setText(getString(test5));

    }

    Also wird schon definiert ;)!
     
Die Seite wird geladen...
Ähnliche Themen Forum Datum
Fehler beim Download bestimmter Webseiten mit httpGet Android App Entwicklung Donnerstag um 15:36 Uhr
Warum Stürtzt meine App ab? (Beim Öffnen von content_3) Android App Entwicklung 27.02.2018
Bluetooth Kommunikation funktioniert ab Android 7 nicht mehr Android App Entwicklung 25.01.2018
android emulator root Android App Entwicklung 19.01.2018
[INFO/DISKUSSION] Google verschärft ab Mitte 2018 Regeln für Android Apps Android App Entwicklung 21.12.2017
Problem beim Geofencing in einer Android App Android App Entwicklung 24.11.2017
[OFFEN] Fehler beim Projekt importieren Android App Entwicklung 03.10.2017
[ERLEDIGET] App über href starten Android App Entwicklung 28.09.2017
[ERLEDIGT] Verbindung zu MS SQL DB von App aus möglich? Android App Entwicklung 05.09.2017
[GESCHLOSSEN] Whatsapp Klon stürtzt ab Android App Entwicklung 06.08.2017
Du betrachtest das Thema "Beim starten auf Emulator stürtz es ab? SQL" im Forum "Android App Entwicklung",