erfan.shahhosini

ارور اکلیپس

3 ارسال در این موضوع قرار دارد

سلام 

آقا تروخذا هرکی میتونه کمکم کنه چند وقته هرکاری میکنم نمیتونم این ارور رو شناسایی کنم ممنون میشم کسی کمکم کنه

این از کلاس دیتا بیس

[shcode=java]  package com.example.dastan;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import java.io.OutputStream;

import android.content.Context;

import android.database.Cursor;

import android.database.SQLException;

import android.database.sqlite.SQLiteDatabase;

import android.database.sqlite.SQLiteOpenHelper;

public class database extends SQLiteOpenHelper {

public final String path="data/data/com.example.dastan/databases/";

public final String Name="database";

public SQLiteDatabase mydb;

private final Context mycontext;

public database(Context context) {

super(context, "database", null, 1);

mycontext=context;

}

@Override

public void onCreate(SQLiteDatabase arg0) {

// TODO Auto-generated method stub

}

@Override

public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

// TODO Auto-generated method stub

}

public void useable(){

boolean checkdb=checkdb();

if(checkdb){

}else{

this.getReadableDatabase();

try{

copydatabase();

}catch(IOException e){

}

}

}

public void open(){

mydb=SQLiteDatabase.openDatabase(path+Name, null, SQLiteDatabase.OPEN_READWRITE);

}

public void close(){

mydb.close();

}

public boolean checkdb(){

SQLiteDatabase db=null;

try{

db=SQLiteDatabase.openDatabase(path+Name, null, SQLiteDatabase.OPEN_READONLY);

}

catch(SQLException e)

{

}

//mydb.close();

return db !=null ? true:false ;

}

public void copydatabase() throws IOException{

OutputStream myOutput = new FileOutputStream(path+Name);

byte[] buffer = new byte[1024];

int length;

InputStream myInput = mycontext.getAssets().open(Name);

while ((length = myInput.read(buffer)) > 0) {

myOutput.write(buffer, 0, length);

}

myInput.close();

myOutput.flush();

myOutput.close();

}

public String Display(int row,int field,String table){

Cursor cu=mydb.rawQuery("select * from "+table, null);

cu.moveToPosition(row);

String s=cu.getString(field);

return s;

}

public Integer count(String table,String field){

Cursor cu=mydb.rawQuery("select * from "+table+" group by "+field,null);

int s=cu.getCount();

return s;

}

public String Season_display(String table,int row){

Cursor cu=mydb.rawQuery("select * from "+table+" group by seasone ", null);

cu.moveToPosition(row);

String s=cu.getString(4);

return s;

}

public Integer Story_count(String table,String sea){

Cursor cu=mydb.rawQuery("select * from "+table+" where seasone='"+sea+"' group by Name",null);

int s=cu.getCount();

return s;

}

  [/shcode]

اینم از کلاس list_season

[shcode=java]package com.example.dastan;

import com.example.dastan.R.layout;

import android.app.ListActivity;

import android.os.Bundle;

import android.view.LayoutInflater;

import android.view.View;

import android.view.ViewGroup;

import android.widget.ArrayAdapter;

import android.widget.TextView;

public class list_season extends ListActivity{

private database db;

private String[]Name;

private String[]Tedad;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.list_season);

db=new database(this);

refresh();

setListAdapter(new AA());

}

class AA extends ArrayAdapter{

public AA(){

super(list_season.this,R.layout.row_season,Name);

}

public View getView(int position, View convertView, ViewGroup parent) {

LayoutInflater in=getLayoutInflater();

View row=in.inflate(R.layout.row_season,parent,false);

TextView name=(TextView)findViewById(R.id.row_season_name);

TextView tedad=(TextView)findViewById(R.id.row_season_tedad);

name.setText(Name[position]);

tedad.setText(Tedad[position]);

return (row);

}

}

private void refresh(){

db.open();

int s=db.count("content", "seasone");

Name=new String;

Tedad=new String;

for(int i=0;i

Name=db.Season_display("content", i);

Tedad=db.Story_count("content", Name.toString())+"";

}

db.close();

}

}

  [/shcode]


[align=left]اینم از فایل logcat[/align]

[align=left]02-24 19:49:53.226: I/dalvikvm(5625): threadid=3: reacting to signal 3[/align]

[align=left]02-24 19:49:53.356: I/dalvikvm(5625): Wrote stack traces to '/data/anr/traces.txt'[/align]

[align=left]02-24 19:50:02.626: D/AndroidRuntime(5625): Shutting down VM[/align]

[align=left]02-24 19:50:02.626: W/dalvikvm(5625): threadid=1: thread exiting with uncaught exception (group=0xa000f180)[/align]

[align=left]02-24 19:50:02.686: D/dalvikvm(5625): GC_CONCURRENT freed 176K, 4% free 6688K/6919K, paused 0ms+0ms[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): FATAL EXCEPTION: main[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): java.lang.NullPointerException[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at com.example.dastan.list_season$AA.getView(list_season.java:44)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.AbsListView.obtainView(AbsListView.java:2033)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.ListView.onMeasure(ListView.java:1155)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.View.measure(View.java:12723)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:579)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:392)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.View.measure(View.java:12723)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.View.measure(View.java:12723)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.View.measure(View.java:12723)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.View.measure(View.java:12723)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.os.Handler.dispatchMessage(Handler.java:99)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.os.Looper.loop(Looper.java:137)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at android.app.ActivityThread.main(ActivityThread.java:4424)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at java.lang.reflect.Method.invokeNative(Native Method)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at java.lang.reflect.Method.invoke(Method.java:511)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)[/align]

[align=left]02-24 19:50:02.686: E/AndroidRuntime(5625): at dalvik.system.NativeStart.main(Native Method)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): close() was never explicitly called on database 'data/data/com.example.dastan/databases/database' [/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java:1943)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:986)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:962)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at com.example.dastan.database.checkdb(database.java:78)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at com.example.dastan.database.useable(database.java:45)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at com.example.dastan.Main.onCreate(Main.java:24)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.Activity.performCreate(Activity.java:4465)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.ActivityThread.access$600(ActivityThread.java:123)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.os.Handler.dispatchMessage(Handler.java:99)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.os.Looper.loop(Looper.java:137)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at android.app.ActivityThread.main(ActivityThread.java:4424)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at java.lang.reflect.Method.invokeNative(Native Method)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at java.lang.reflect.Method.invoke(Method.java:511)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)[/align]

[align=left]02-24 19:50:02.696: E/SQLiteDatabase(5625): at dalvik.system.NativeStart.main(Native Method)[/align]

[align=left]02-24 19:50:02.766: I/dalvikvm(5625): threadid=3: reacting to signal 3[/align]

[align=left]02-24 19:50:02.846: I/dalvikvm(5625): Wrote stack traces to '/data/anr/traces.txt'[/align]

[align=left]02-24 19:50:03.196: I/dalvikvm(5625): threadid=3: reacting to signal 3[/align]

[align=left]02-24 19:50:03.196: I/dalvikvm(5625): Wrote stack traces to '/data/anr/traces.txt'[/align]

[align=left]02-24 19:50:04.186: I/Process(5625): Sending signal. PID: 5625 SIG: 9[/align]

به اشتراک گذاری این پست


لینک به ارسال
به اشتراک گذاری در سایت های دیگر

آرایه هایی که تعریف کردی، مقدار اولیه ندارن.

به اشتراک گذاری این پست


لینک به ارسال
به اشتراک گذاری در سایت های دیگر

آرایه هایی که تعریف کردی، مقدار اولیه ندارن.

الان کدام قسمتو باید اصلاح کنم؟

:huh:

به اشتراک گذاری این پست


لینک به ارسال
به اشتراک گذاری در سایت های دیگر

برای ارسال نظر یک حساب کاربری ایجاد کنید یا وارد حساب خود شوید

برای اینکه بتوانید نظر ارسال کنید نیاز دارید که کاربر سایت شوید

ایجاد یک حساب کاربری

برای حساب کاربری جدید در انجمن ما ثبت نام کنید. عضویت خیلی ساده است !


ثبت نام یک حساب کاربری جدید

ورود به حساب کاربری

دارای حساب کاربری هستید؟ از اینجا وارد شوید


ورود به حساب کاربری