私は自分のカスタムアダプターを使ってフラグメント内のListViewを埋めようとしていますが、実行時にタブを選択するとこの例外が発生するようです。 [イベント]タブをクリックしたときにこの例外がスローされる主な原因は何ですか?ここで TransactionTooLargeExceptionの原因?
はここpackage com.lucasmikesoftware.messaround;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
public class EventsPast extends Fragment {
public EventsPast() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View theView = inflater.inflate(R.layout.fragment_events_past, container, true);
String[] fakeData = {"Donald Trump is running for president","Twins trade for Clayton Kershaw",
"Derek Banas's Android Tutorial Series Helped Me Make This","This is some more fake news"};
ListView listView = (ListView) theView.findViewById(R.id.fragment_events_past_list_view);
ListAdapter adapter = new MyAdapter(getContext(),fakeData);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
}
});
// Inflate the layout for this fragment
return theView;
}
}
はXMLファイルですEventsPastクラスMyAdapterクラスここ
package com.lucasmikesoftware.messaround;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyAdapter extends ArrayAdapter<String> {
public MyAdapter(Context context, String[] values) {
super(context, R.layout.events_past_list_item, values);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater theInflater = LayoutInflater.from(getContext());
View theView = theInflater.inflate(R.layout.events_past_list_item,parent,false);
String itemTitle = getItem(position);
TextView theTextView = (TextView) theView.findViewById(R.id.text_view);
theTextView.setText(itemTitle);
ImageView theImageView = (ImageView) theView.findViewById(R.id.image_view);
theImageView.setImageResource(R.drawable.icon_events);
return theView;
}
}
されている fragment_events_past.xml
<FrameLayout 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"
tools:context=".EventsPast">
<!-- TODO: Update blank fragment layout -->
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fragment_events_past_list_view"
android:layout_gravity="left|top" />
</FrameLayout>
events_past_list_item.xml
の<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="15dp"
android:id="@+id/image_view"
android:src="@drawable/icon_events"/>
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:textSize="16sp"
android:id="@+id/text_view"
android:gravity="center_vertical"/>
</LinearLayout>
エラーメッセージ
7月30日16:38:14.888 22018から22018/com.lucasmikesoftware.messaroundのD /エラー:ERR:スタック=によってjava.lang.StackOverflowError:アンドロイドでスタックサイズ8メガバイト 。 android.graphicsの で、view.View.invalidateInternal(View.java:11749) android.view.View.invalidate(View.java:11711) android.view.View.invalidateDrawable(View.java:15845) です。 drawable.Drawable.invalidateSelf(Drawable.java:367) android.graphics.drawable.RippleDrawable.jumpToCurrentState(RippleDrawable.java:221)android.widget.FrameLayout.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.widget.AbsListView.jumpDrawablesToCurrentState(AbsListView.java:2974) (FrameLayout.java:224) ででandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848)android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848)で android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848)で アンドロイドで 。 view.ViewGroup.javaDrawablesToCurrentState(ViewGroup.java:5848) android.view.View.jumpDrawablesToCurrentState(ViewGroup.java:5) android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) における848) android.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) (ViewGroup.java:5848)でandroid.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) (ViewGroup.java:5848) ででandroid.view.View.View.View.JumpDrawablesToCurrentState(ViewGroup.java:5848) android.view.View.jumpDrawablesToCurrentState(ViewGrou android.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) (のViewGroupにp.java:5848) 。 java:5848) android.view.View.View.View.jumpDrawablesToCurrentState(ViewGroup.java:5848) にandroid.view.View.JumpDrawablesToCurrentState(ビューグループ。java:5848) android.view.View.View.jumpDrawablesToCurrentState(ViewGroup.java:5848) (android.view.View.jumpDrawablesToCurrentState(ViewGroup.java:5848)) (android.view.View.jumpDrawablesToCurrentState(ViewGroup.java: 5848)android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848)android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848)android.view.ViewGroup.jumpDrawablesToCurrentStateで で(ViewGroup.java:5848で ) android.view.View.View.View.jumpDrawablesToCurrentState(ViewGroup.java:5848)の android.view.View.jumpDrawablesToCurrentStateの ewGroup.java:5848)android.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) で(のViewGroup。 Javaの:5848) android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) (ViewGroup.javaで: 5848) android.view.View.View.View.jumpDrawablesToCurrentState(ViewGroup.java:5848) android.view.View.jumpDrawablesToCurrent状態(ViewGroup.java:5848) android.view.View.View.jumpDrawablesToCurrentState(ViewGroup.java:5848) at android.view.View.jumpDrawablesToCurrentState(ViewGroup.java:5848) android.view.View.jumpDrawablesToCurrentState ViewGroup.java:5848)android.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) で(のViewGroup。 java:5848)android.view.View.View.jumpDrawablesTの にある のandroid.view.View.View.JumpDrawablesToCurrentState(ViewGroup.java:5848) android.view.ViewGroup.jumpDrawablesToCurrentStateでandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でandroid.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5848) でoCurrentState(ViewGroup.java:5848) ( ViewGroup.java:5848) android.view.ViewGrou 07-30 16:38:14.898 22018-22053/com.lucasmikesoftware.messaround I/art:背景部分同時マーク掃引GC解放41(3024B)AllocSpaceオブジェクト、1 (22MB)LOSオブジェクト、14%無料、92MB/108MB、一時停止1.953ms合計215.717ms 07-30 16:38:14.908 22018-22018/com.lucasmikesoftware.messaround E/JavaBinder:!!! FAILED BINDER TRANSACTION !!! 07-30 16:38:14.908 22018-22018/com.lucasmikesoftware.messaround D /エラー:ERR:合計バイト数:19877752 07-30 16:38:14.908 22018-22018/com.lucasmikesoftware.messaround E/AndroidRuntime :エラーandroid.app.ActivityManagerProxy.handleApplicationCrashでandroid.os.BinderProxy.transact(Binder.java:504) (ActivityManagerNativeでandroid.os.BinderProxy.transactNative(ネイティブメソッド) でクラッシュ android.os.TransactionTooLargeException 報告.java:4179) com.android.internal.os.RuntimeInit $ UncaughtHandler.uncaughtException(RuntimeInit.java:118) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) 、java.lang.ThreadGroup.uncaughtException(ThreadGroup。java:690) 07-30 16:38:14.908 22018-22018/com.lucasmikesoftware.messaround D/Process:killProcess、pid = 22018 07-30 16:38:14.918 22018-22018/com.lucasmikesoftware.messaround D /プロセス:com.android.internal.os.RuntimeInit $ UncaughtHandler.uncaughtException:138 java.lang.ThreadGroup.uncaughtException:693 java.lang.ThreadGroup.uncaughtException:690
例外の原因がわかるようにstacktraceを追加してください –