2013-12-12 3 views
1

내 데이터베이스에서 '내보기'버튼을 실행하지 않습니다.Android Manifest가 활동을 시작하지 않습니다.

이것은 내 logcat입니다. 내가 Manifest를 선언하지 않았을 가능성이 있습니까?

로그 캣 :

12-14 06:56:56.316: E/AndroidRuntime(1144): FATAL EXCEPTION: main 
12-14 06:56:56.316: E/AndroidRuntime(1144): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jacob.eindproject/com.jacob.eindproject.SQLView}: java.lang.NullPointerException 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.os.Handler.dispatchMessage(Handler.java:99) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.os.Looper.loop(Looper.java:137) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread.main(ActivityThread.java:5103) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at java.lang.reflect.Method.invokeNative(Native Method) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at java.lang.reflect.Method.invoke(Method.java:525) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at dalvik.system.NativeStart.main(Native Method) 
12-14 06:56:56.316: E/AndroidRuntime(1144): Caused by: java.lang.NullPointerException 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at com.jacob.eindproject.Database.<init>(Database.java:63) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at com.jacob.eindproject.SQLView.onCreate(SQLView.java:14) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.Activity.performCreate(Activity.java:5133) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 
12-14 06:56:56.316: E/AndroidRuntime(1144):  ... 11 more 

이 내 안드로이드 매니페스트입니다 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 


<TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent"   android:id="@+id/tableLayout1"> 

    <TableRow> 

      <TextView android:text="@string/Names"  android:layout_width="fill_parent" android:layout_height="fill_parent"  android:layout_weight="1"/> 

      <TextView android:text="@string/Hotness" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:layout_weight="1" /> 

    </TableRow> 


    </TableLayout> 

    <TextView android:id="@+id/tvSQLinfo" android:layout_width="fill_parent"  android:layout_height="fill_parent" android:text="@string/info"/> 

    </LinearLayout> 
: 이것은 내 view.xml이

package com.jacob.eindproject; 

import android.app.Activity; 
import android.os.Bundle; 
import android.widget.TextView; 

public class SQLView extends Activity{ 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.sqlview); 
    TextView tv = (TextView) findViewById(R.id.tvSQLinfo); 
    Database info = new Database(this); 
    info.open(); 
    String data = info.getData(); 
    info.close(); 
    tv.setText(data); 





} 

} 

입니다 : 이것은 내보기 클래스는

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.jacob.eindproject" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="18" /> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 


    <activity 
     android:name="com.jacob.eindproject.Menu" 
     android:label="@string/app_name" > 
    </activity> 

    <activity 
     android:name="com.jacob.eindproject.Inleiding" 
     android:label="@string/app_name" > 
       <intent-filter> 
         <action android:name="android.intent.action.MAIN" /> 
         <category   android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
    </activity> 

    <activity 
     android:name="com.jacob.eindproject.MainActivity" 
     android:label="@string/app_name" > 
            <intent-filter> 
         <action android:name="android.intent.action.MAIN" /> 
         <category  android:name="android.intent.category.DEFAULT" /> 
       </intent-filter> 
    </activity>   

    <activity 
     android:name="com.jacob.eindproject.Ondergewicht" 
     android:label="@string/app_name" > 
    </activity>   

    <activity 
     android:name="com.jacob.eindproject.Gezond_gewicht" 
     android:label="@string/app_name" > 
    </activity> 

    <activity 
     android:name="com.jacob.eindproject.Overgewicht" 
     android:label="@string/app_name" > 
    </activity> 

    <activity 
     android:name="com.jacob.eindproject.Database" 
     android:label="@string/app_name" > 
    </activity>     

    <activity 
     android:name="com.jacob.eindproject.SQLite" 
     android:label="@string/app_name" > 
    </activity> 


    <activity 
     android:name="com.jacob.eindproject.SQLView" 
     android:label="@string/app_name" > 

    </activity>   

</application> 

</manifest> 

입니다(210)

이 내 데이터베이스 클래스 :

package com.jacob.eindproject; 

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

import java.sql.*; 

    public class Database { 

public static final String KEY_ROWID = "_id"; 
public static final String KEY_NAME = "persons_name"; 
public static final String KEY_HOTNESS = "persons_hotness"; 

private static final String DATABASE_NAME = "HotOrNotdb"; 
private static final String DATABASE_TABLE = "peopleTable"; 
private static final int DATABASE_VERSION = 1; 

private DbHelper ourHelper; 
private final Context ourContext; 
private SQLiteDatabase ourDatabase; 

private static class DbHelper extends SQLiteOpenHelper{ 

    public DbHelper(Context context) { 
     super(context, DATABASE_NAME, null, DATABASE_VERSION); 
     // TODO Auto-generated constructor stub 
    } 

    public void onCreate(SQLiteDatabase db) { 
     db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + 
       KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, "  + 
       KEY_NAME + " TEXT NOT NULL, " + 
       KEY_HOTNESS + " TEXT NOT NULL);"      
    ); 


    } 

    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 
     db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE); 
     onCreate(db); 
    } 
} 



public Database(Context c){ 
    ourContext = c; 
} 

public Database open() throws SQLException{ 
    ourHelper = new DbHelper(ourContext); 
    ourDatabase = ourHelper.getWritableDatabase(); 
    return this;   
} 

public void close() { 
} { 
ourHelper.close(); 
    } 



public void createEntry(String name, String hotness) { 
    ContentValues cv = new ContentValues(); 
    cv.put(KEY_NAME, name); 
    cv.put(KEY_HOTNESS, hotness); 
    ourDatabase.insert(DATABASE_TABLE, null, cv); 

} 

public String getData() { 
    // TODO Auto-generated method stub 
    String[] columns = new String[]{ KEY_ROWID, KEY_NAME, KEY_HOTNESS}; 
    Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,  null, null); 
    String result = ""; 

    int iRow = c.getColumnIndex(KEY_ROWID); 
    int iName = c.getColumnIndex(DATABASE_NAME); 
    int iHotness = c.getColumnIndex(KEY_HOTNESS); 

    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){ 
     result = result + c.getString(iRow) + " " + c.getString(iName) + " " + c.getString(iHotness) + "\n"; 


    } 

    return null; 
} 
    } 

누군가가 나를 도울 수 있습니까? 대단 하시겠습니까!

야곱

+0

com.jacob.eindproject의 패키지 정보를 가져올 수 없습니다. 패키지가 설치되지 않았습니까? - 확인해. 어떤 활동을 시작하고 싶습니까? – Serafins

+0

이전에 실행중인 내 앱 인스턴스가 제대로 닫히지 않을 수 있습니다. – Uma

+0

앱을 수동으로 제거한 다음 IDE를 실행하면 어떻게됩니까? – Melquiades

답변

0

제거이

<activity 
     android:name="com.jacob.eindproject.Database" 
     android:label="@string/app_name" > 
    </activity> 

Databaseactivity 없습니다.

관련 문제