2

まず最初に、すべてのjava.lang.Stackoverflowerrorエラーの質問を試しましたが、このエラーを変更するものは何もありません。なぜこのエラーが発生するのですか?

私のListeleActivityクラスは;

 package com.mobil.eposta;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.mail.Message;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

public class ListeleActivity extends Activity
{
    static List<String> gelen;
    static ListView listView;
    static ArrayList<String> konulist;
    static ArrayList<String> kimdenlist;
    static ArrayList<String> govdelist;
    static ArrayAdapter<String> arrayAdapter;
    static ArrayList<String> dosyaIsmi;
    static Message[] messageslist;
    static int messagePosition;
    static int onClickPosition;
    static boolean messageEkBulunuyormu;

    ArrayList<String> eklist;
    int clickKonum;
    static boolean ekvar;

    ListView lv;
    Button btnSave, btnClear;
    HashMap<Integer, Boolean> mCartItems = new HashMap<Integer, Boolean>();

    Baglanti baglantiNesnesi = new Baglanti();
//  EkDurumu ekdurumuNesnesi = new EkDurumu();
//  GoruntuleActivity goruntuleNesnesi = new GoruntuleActivity();

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listalt);

        konulist = (ArrayList<String>) baglantiNesnesi.getKonu();
        kimdenlist = (ArrayList<String>) baglantiNesnesi.getKimden();
        govdelist = (ArrayList<String>) baglantiNesnesi.getGovde();
        messageslist = baglantiNesnesi.messages;

        lv = (ListView) findViewById(R.id.list);
        LayoutInflater mLInflater = getLayoutInflater();
        final ListViewAdapter adapter = new ListViewAdapter(getApplicationContext(),
                kimdenlist, konulist, mLInflater);
        lv.setAdapter(adapter);
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick( AdapterView<?> parent, View item, 
                                       int position, long id) 
              {
                    final Intent intent = new Intent(ListeleActivity.this, GoruntuleActivity.class);
                    startActivity(intent);
                    onClickPosition = position;
                    Toast.makeText(ListeleActivity.this, "Bastın", Toast.LENGTH_SHORT).show();
              }
            });
    }
}

そして私のGoruntuleActivity.classは;

public class GoruntuleActivity extends Activity
{
    ListeleActivity listeleNesnesi = new ListeleActivity();

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.epostagoruntuleme);
         }
}


   05-07 17:24:32.796: E/AndroidRuntime(728): FATAL EXCEPTION: main
05-07 17:24:32.796: E/AndroidRuntime(728): java.lang.StackOverflowError
05-07 17:24:32.796: E/AndroidRuntime(728):  at java.lang.Thread.currentThread(Thread.java:588)
05-07 17:24:32.796: E/AndroidRuntime(728):  at java.lang.ThreadLocal.get(ThreadLocal.java:59)
05-07 17:24:32.796: E/AndroidRuntime(728):  at android.os.Looper.myLooper(Looper.java:137)
05-07 17:24:32.796: E/AndroidRuntime(728):  at android.os.Handler.<init>(Handler.java:119)
05-07 17:24:32.796: E/AndroidRuntime(728):  at android.app.Activity.<init>(Activity.java:679)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:23)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.java:25)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.ListeleActivity.<init>(ListeleActivity.java:48)
05-07 17:24:32.796: E/AndroidRuntime(728):  at com.mobil.eposta.GoruntuleActivity.<init>(GoruntuleActivity.ja
05-07 17:24:33.006: D/dalvikvm(728): GC_FOR_MALLOC freed 3074 objects / 569272 bytes in 124ms
05-07 17:29:33.127: I/Process(728): Sending signal. PID: 728 SIG: 9

マニフェスト

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

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MobilEpostaUygActivity"
            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=".ListeleActivity"/>
         <activity android:name=".GoruntuleActivity"/>
    </application>
     <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
</manifest>
4

1 に答える 1

3

自分でアクティビティを作成しないでください。これらの行は不要です(そしてスタックオーバーフローを引き起こします):

ListeleActivity listeleNesnesi = new ListeleActivity();

GoruntuleActivity goruntuleNesnesi = new GoruntuleActivity();

アクティビティのコンストラクターを呼び出す代わりに、新しいコンストラクターを作成してIntentに渡すことでアクティビティーを作成しstartActivityます。詳細については、 Androidの基礎に関するこのドキュメントをお読みください。

于 2012-05-07T17:44:40.770 に答える