Bundle Hala Geçmedi, Bakarmısınız?
Yasin Abi sağolsun çok yardımcı oldun, ama söylediklerini yaptım ve hala sorun çıkıyor. ListView'i açarken uygulama durduruluyor.
Şuradaki ListView de sorun çıkıyor debug yaparken;
package com.monsterdroid.howtoloseweight;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends Activity {
private static List<Country> Countries;
private ExpandableListView expandableListView;
private CountryAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.secim);
LoadCountries();
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView1);
adapter = new CountryAdapter(this, Countries);
expandableListView.setAdapter(adapter);
final Bundle bundle = new Bundle();
final Intent intent = new Intent(MainActivity.this, EkranBir.class);
expandableListView.setOnChildClickListener(new OnChildClickListener(){
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
if (groupPosition==0){
if (childPosition==0){
bundle.putString("baslikveri",getString(R.string.bas1));
bundle.putString("maddeveri",getString(R.string.mad1));
bundle.putString("icerikveri",getString(R.string.ic1));
}
if(childPosition==1)
{
bundle.putString("baslikveri",getString(R.string.bas2));
bundle.putString("maddeveri",getString(R.string.mad2));
bundle.putString("icerikveri",getString(R.string.ic2));
}
if(childPosition==2)
{
bundle.putString("baslikveri",getString(R.string.bas3));
bundle.putString("maddeveri",getString(R.string.mad3));
bundle.putString("icerikveri",getString(R.string.ic3));
}
if(childPosition==3)
{
bundle.putString("baslikveri",getString(R.string.bas4));
bundle.putString("maddeveri",getString(R.string.mad4));
bundle.putString("icerikveri",getString(R.string.ic4));
}
}
if (groupPosition==1){
if(childPosition==4)
{
bundle.putString("baslikveri",getString(R.string.bas5));
bundle.putString("maddeveri",getString(R.string.mad5));
bundle.putString("icerikveri",getString(R.string.ic5));
}
if(childPosition==5)
{
bundle.putString("baslikveri",getString(R.string.bas6));
bundle.putString("maddeveri",getString(R.string.mad6));
bundle.putString("icerikveri",getString(R.string.ic6));
}
if(childPosition==6)
{
bundle.putString("baslikveri",getString(R.string.bas7));
bundle.putString("maddeveri",getString(R.string.mad7));
bundle.putString("icerikveri",getString(R.string.ic7));
}
if(childPosition==7)
{
bundle.putString("baslikveri",getString(R.string.bas8));
bundle.putString("maddeveri",getString(R.string.mad8));
bundle.putString("icerikveri",getString(R.string.ic8));
}
if(childPosition==8)
{
bundle.putString("baslikveri",getString(R.string.bas9));
bundle.putString("maddeveri",getString(R.string.mad9));
bundle.putString("icerikveri",getString(R.string.ic9));
}
if(childPosition==9)
{
bundle.putString("baslikveri",getString(R.string.bas10));
bundle.putString("maddeveri",getString(R.string.mad10));
bundle.putString("icerikveri",getString(R.string.ic10));
}
}
if (groupPosition==2){
if(childPosition==10)
{
bundle.putString("baslikveri",getString(R.string.bas11));
bundle.putString("maddeveri",getString(R.string.mad11));
bundle.putString("icerikveri",getString(R.string.ic11));
}
if(childPosition==11)
{
bundle.putString("baslikveri",getString(R.string.bas12));
bundle.putString("maddeveri",getString(R.string.mad12));
bundle.putString("icerikveri",getString(R.string.ic12));
}
if(childPosition==12)
{
bundle.putString("baslikveri",getString(R.string.bas13));
bundle.putString("maddeveri",getString(R.string.mad13));
bundle.putString("icerikveri",getString(R.string.ic13));
}
}
if (groupPosition==3){
if(childPosition==13)
{
bundle.putString("baslikveri",getString(R.string.bas14));
bundle.putString("maddeveri",getString(R.string.mad14));
bundle.putString("icerikveri",getString(R.string.ic14));
}
if(childPosition==14)
{
bundle.putString("baslikveri",getString(R.string.bas15));
bundle.putString("maddeveri",getString(R.string.mad15));
bundle.putString("icerikveri",getString(R.string.ic15));
}
if(childPosition==15)
{
bundle.putString("baslikveri",getString(R.string.bas16));
bundle.putString("maddeveri",getString(R.string.mad16));
bundle.putString("icerikveri",getString(R.string.ic16));
}
if(childPosition==16)
{
bundle.putString("baslikveri",getString(R.string.bas17));
bundle.putString("maddeveri",getString(R.string.mad17));
bundle.putString("icerikveri",getString(R.string.ic17));
}
}
if (groupPosition==4){
if(childPosition==17)
{
bundle.putString("baslikveri",getString(R.string.bas18));
bundle.putString("maddeveri",getString(R.string.mad18));
bundle.putString("icerikveri",getString(R.string.ic18));
}
if(childPosition==18)
{
bundle.putString("baslikveri",getString(R.string.bas19));
bundle.putString("maddeveri",getString(R.string.mad19));
bundle.putString("icerikveri",getString(R.string.ic19));
}
if(childPosition==19)
{
bundle.putString("baslikveri",getString(R.string.bas20));
bundle.putString("maddeveri",getString(R.string.mad20));
bundle.putString("icerikveri",getString(R.string.ic20));
}
if(childPosition==20)
{
bundle.putString("baslikveri",getString(R.string.bas21));
bundle.putString("maddeveri",getString(R.string.mad21));
bundle.putString("icerikveri",getString(R.string.ic21));
}
if(childPosition==21)
{
bundle.putString("baslikveri",getString(R.string.bas22));
bundle.putString("maddeveri",getString(R.string.mad22));
bundle.putString("icerikveri",getString(R.string.ic22));
}
if(childPosition==22)
{
bundle.putString("baslikveri",getString(R.string.bas23));
bundle.putString("maddeveri",getString(R.string.mad23));
bundle.putString("icerikveri",getString(R.string.ic23));
}
}
if (groupPosition==5){
if(childPosition==23)
{
bundle.putString("baslikveri",getString(R.string.bas24));
bundle.putString("maddeveri",getString(R.string.mad24));
bundle.putString("icerikveri",getString(R.string.ic24));
}
if(childPosition==24)
{
bundle.putString("baslikveri",getString(R.string.bas25));
bundle.putString("maddeveri",getString(R.string.mad25));
bundle.putString("icerikveri",getString(R.string.ic25));
}
if(childPosition==25)
{
bundle.putString("baslikveri",getString(R.string.bas26));
bundle.putString("maddeveri",getString(R.string.mad26));
bundle.putString("icerikveri",getString(R.string.ic26));
}
if(childPosition==26)
{
bundle.putString("baslikveri",getString(R.string.bas27));
bundle.putString("maddeveri",getString(R.string.mad27));
bundle.putString("icerikveri",getString(R.string.ic27));
}
}
intent.putExtras(bundle);
startActivity(intent);
return false;
}
});
}
private void LoadCountries() {
Countries = new ArrayList<Country>();
ArrayList<String> liste1 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis1),getString(R.string.lis2),getString(R.string.lis3),getString(R.string.lis4)));
Countries.add(new Country("Rules of Thumb", liste1));
ArrayList<String> liste2 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis5),getString(R.string.lis6),getString(R.string.lis7),getString(R.string.lis8),getString(R.string.lis9),getString(R.string.lis10)));
Countries.add(new Country("Low-Calorie Diet", liste2));
ArrayList<String> liste3 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis11),getString(R.string.lis12),getString(R.string.lis13)));
Countries.add(new Country("Low-Carb Diet", liste3));
ArrayList<String> liste4 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis14),getString(R.string.lis15),getString(R.string.lis16),getString(R.string.lis17)));
Countries.add(new Country("Other Diets", liste4));
ArrayList<String> liste5 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis18),getString(R.string.lis19),getString(R.string.lis20),getString(R.string.lis21),getString(R.string.lis22),getString(R.string.lis23)));
Countries.add(new Country("Burn Calories", liste5));
ArrayList<String> liste6 = new ArrayList<String>(
Arrays.asList(getString(R.string.lis24),getString(R.string.lis25),getString(R.string.lis26),getString(R.string.lis27)));
Countries.add(new Country("Stay Motivated", liste6));
}
}
Bu da Son LogCat;
12-16 00:09:36.014: D/dalvikvm(13997): GC_FOR_ALLOC freed 76K, 13% free 9354K/10691K, paused 22ms, total 23ms
12-16 00:09:36.024: I/dalvikvm-heap(13997): Grow heap (frag case) to 10.817MB for 588816-byte allocation
12-16 00:09:36.044: D/dalvikvm(13997): GC_CONCURRENT freed <1K, 12% free 9929K/11271K, paused 13ms+2ms, total 28ms
12-16 00:09:36.134: D/libEGL(13997): loaded /system/lib/egl/libEGL_mali.so
12-16 00:09:36.144: D/libEGL(13997): loaded /system/lib/egl/libGLESv1_CM_mali.so
12-16 00:09:36.144: D/libEGL(13997): loaded /system/lib/egl/libGLESv2_mali.so
12-16 00:09:36.164: D/OpenGLRenderer(13997): Enabling debug mode 0
12-16 00:09:36.224: W/IInputConnectionWrapper(13997): showStatusIcon on inactive InputConnection
12-16 00:09:40.168: D/dalvikvm(13997): GC_FOR_ALLOC freed 9K, 12% free 9965K/11271K, paused 16ms, total 17ms
12-16 00:09:41.569: D/dalvikvm(13997): GC_CONCURRENT freed 11K, 11% free 10375K/11655K, paused 12ms+12ms, total 41ms
12-16 00:09:41.569: D/dalvikvm(13997): WAIT_FOR_CONCURRENT_GC blocked 25ms
12-16 00:09:41.569: I/dalvikvm-heap(13997): Grow heap (frag case) to 12.118MB for 908616-byte allocation
12-16 00:09:41.599: D/dalvikvm(13997): GC_CONCURRENT freed 595K, 16% free 10666K/12551K, paused 12ms+2ms, total 29ms
12-16 00:09:41.599: D/dalvikvm(13997): WAIT_FOR_CONCURRENT_GC blocked 4ms
12-16 00:09:44.222: D/dalvikvm(13997): GC_FOR_ALLOC freed 19K, 14% free 10874K/12551K, paused 17ms, total 17ms
12-16 00:09:44.222: I/dalvikvm-heap(13997): Grow heap (frag case) to 12.455MB for 749968-byte allocation
12-16 00:09:44.252: D/dalvikvm(13997): GC_CONCURRENT freed <1K, 13% free 11606K/13319K, paused 12ms+2ms, total 28ms
12-16 00:09:44.272: D/dalvikvm(13997): GC_FOR_ALLOC freed <1K, 13% free 11612K/13319K, paused 16ms, total 16ms
12-16 00:09:44.272: I/dalvikvm-heap(13997): Grow heap (frag case) to 12.844MB for 403216-byte allocation
12-16 00:09:44.292: D/dalvikvm(13997): GC_FOR_ALLOC freed <1K, 13% free 12005K/13767K, paused 15ms, total 15ms
12-16 00:09:48.106: D/AbsListView(13997): Get MotionRecognitionManager
12-16 00:09:48.166: D/AndroidRuntime(13997): Shutting down VM
12-16 00:09:48.166: W/dalvikvm(13997): threadid=1: thread exiting with uncaught exception (group=0x419902a0)
12-16 00:09:48.186: E/AndroidRuntime(13997): FATAL EXCEPTION: main
12-16 00:09:48.186: E/AndroidRuntime(13997): java.lang.NullPointerException
12-16 00:09:48.186: E/AndroidRuntime(13997): at com.monsterdroid.howtoloseweight.CountryAdapter.getGroupView(CountryAdapter.java:63)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:451)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.AbsListView.obtainView(AbsListView.java:2465)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.ListView.makeAndAddView(ListView.java:1775)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.ListView.fillDown(ListView.java:678)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.ListView.fillFromTop(ListView.java:739)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.ListView.layoutChildren(ListView.java:1628)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.AbsListView.onLayout(AbsListView.java:2300)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.View.layout(View.java:13856)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewGroup.layout(ViewGroup.java:4424)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.View.layout(View.java:13856)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewGroup.layout(ViewGroup.java:4424)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.View.layout(View.java:13856)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewGroup.layout(ViewGroup.java:4424)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.View.layout(View.java:13856)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewGroup.layout(ViewGroup.java:4424)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.View.layout(View.java:13856)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewGroup.layout(ViewGroup.java:4424)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1992)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1813)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.Choreographer.doFrame(Choreographer.java:525)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.os.Handler.handleCallback(Handler.java:615)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.os.Handler.dispatchMessage(Handler.java:92)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.os.Looper.loop(Looper.java:137)
12-16 00:09:48.186: E/AndroidRuntime(13997): at android.app.ActivityThread.main(ActivityThread.java:4867)
12-16 00:09:48.186: E/AndroidRuntime(13997): at java.lang.reflect.Method.invokeNative(Native Method)
12-16 00:09:48.186: E/AndroidRuntime(13997): at java.lang.reflect.Method.invoke(Method.java:511)
12-16 00:09:48.186: E/AndroidRuntime(13997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
12-16 00:09:48.186: E/AndroidRuntime(13997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
12-16 00:09:48.186: E/AndroidRuntime(13997): at dalvik.system.NativeStart.main(Native Method)
Yardım ederseniz çok teşekkür ederim, herkese iyi çalışmalar...