Is there no one who could help me?

On Dec 12, 12:57 pm, Abhi <abhishek.r.sha...@gmail.com> wrote:
> 12-12 12:25:13.412: INFO/ActivityManager(589): Starting activity:
> Intent { act=android.intent.action.MAIN cat=
> [android.intent.category.LAUNCHER] flg=0x10200000
> cmp=com.sample.headerlist/.headerlist }
> 12-12 12:25:13.530: INFO/ActivityManager(589): Start proc
> com.sample.headerlist for activity com.sample.headerlist/.headerlist:
> pid=1117 uid=10030 gids={1015}
> 12-12 12:25:13.760: INFO/jdwp(1117): received file descriptor 20 from
> ADB
> 12-12 12:25:13.841: DEBUG/ddm-heap(1117): Got feature list request
> 12-12 12:25:14.691: INFO/ActivityManager(589): Displayed activity
> com.sample.headerlist/.headerlist: 1237 ms (total 1237 ms)
> 12-12 12:25:18.550: DEBUG/dalvikvm(650): GC freed 7442 objects /
> 405984 bytes in 210ms
> 12-12 12:25:19.800: DEBUG/dalvikvm(652): GC freed 307 objects / 12784
> bytes in 94ms
> 12-12 12:25:52.901: DEBUG/dalvikvm(589): GC freed 9930 objects /
> 447368 bytes in 169ms
> 12-12 12:26:19.130: DEBUG/AndroidRuntime(1117): Shutting down VM
> 12-12 12:26:19.130: WARN/dalvikvm(1117): threadid=3: thread exiting
> with uncaught exception (group=0x4001aa28)
> 12-12 12:26:19.130: ERROR/AndroidRuntime(1117): Uncaught handler:
> thread main exiting due to uncaught exception
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):
> java.lang.ClassCastException: android.widget.ArrayAdapter
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.sample.headerlist.headerlist.onClick(headerlist.java:59)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.View.performClick(View.java:2344)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.View.onTouchEvent(View.java:4133)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.widget.TextView.onTouchEvent(TextView.java:6504)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.View.dispatchTouchEvent(View.java:3672)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
> (PhoneWindow.java:1202)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.app.Activity.dispatchTouchEvent(Activity.java:1987)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.os.Looper.loop(Looper.java:123)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> android.app.ActivityThread.main(ActivityThread.java:4203)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> (ZygoteInit.java:791)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
> 12-12 12:26:19.151: ERROR/AndroidRuntime(1117):     at
> dalvik.system.NativeStart.main(Native Method)
> 12-12 12:26:19.160: INFO/Process(589): Sending signal. PID: 1117 SIG:
> 3
> 12-12 12:26:19.160: INFO/dalvikvm(1117): threadid=7: reacting to
> signal 3
> 12-12 12:26:19.160: ERROR/dalvikvm(1117): Unable to open stack trace
> file '/data/anr/traces.txt': Permission denied
> 12-12 12:26:21.670: INFO/Process(1117): Sending signal. PID: 1117 SIG:
> 9
> 12-12 12:26:21.810: INFO/ActivityManager(589): Process
> com.sample.headerlist (pid 1117) has died.
> 12-12 12:26:21.821: INFO/WindowManager(589): WIN DEATH: Window
> {43940038 com.sample.headerlist/com.sample.headerlist.headerlist
> paused=false}
> 12-12 12:26:21.880: WARN/UsageStats(589): Unexpected resume of
> com.android.launcher while already resumed in com.sample.headerlist
> 12-12 12:26:21.981: WARN/InputManagerService(589): Got RemoteException
> sending setActive(false) notification to pid 1117 uid 10030
>
> Above is the Logcat from the time I press any of those two buttons
> which results in a Force Close. I don' think I understand it well, but
> looks like there is something wrong in the way I add items to the
> List
>
> strings.add("another one");
> ((ArrayAdapter<String>) ((HeaderViewListAdapter) listView.getAdapter
> ()).getWrappedAdapter()).notifyDataSetChanged();
>
> Please help me. Where am I going wrong?
>
> Abhishek
>
> On Dec 11, 4:59 pm, Romain Guy <romain...@android.com> wrote:
>
>
>
> > Either run adb logcat from a shell (adb in the tools directory of the
> > SDK), or run DDMS and check the logs at the bottom, or open the Logcat
> > view in Eclipse.
>
> > > Could you please tell me how to go about doing that? I can paste the
> > > log data here if I don't understand at first look.
>
> > If you don't understand at first look, read it more carefully, repeat
> > the issue, etc.
>
> > > Thanks,
>
> > > Abhishek
>
> > > On Dec 11, 4:48 pm, Romain Guy <romain...@android.com> wrote:
> > >> Have you looked at the log to see the stack trace? This would tell you
> > >> exactly why your app is crashing :)
>
> > >> On Fri, Dec 11, 2009 at 1:46 PM, Abhi <abhishek.r.sha...@gmail.com> 
> > >> wrote:
> > >> > Hi All,
>
> > >> > I have an Absolute Layout with two buttons on top, a Text View of
> > >> > fixed size in the middle and List View as the rest of the Layout.
>
> > >> > I want to use the top left button to add a list view item to the
> > >> > existing list and the top right button to remove the last item from
> > >> > the list. The List is layed out properly when the App starts, but as
> > >> > soon as any of the two buttons is pressed, the Activity Force Closes.
>
> > >> > Here is the code:
>
> > >> > package com.sample.headerlist;
>
> > >> > import java.util.ArrayList;
> > >> > import java.util.List;
>
> > >> > import android.app.Activity;
> > >> > import android.os.Bundle;
> > >> > import android.view.View;
> > >> > import android.widget.ArrayAdapter;
> > >> > import android.widget.Button;
> > >> > import android.widget.HeaderViewListAdapter;
> > >> > import android.widget.ListView;
> > >> > import android.widget.TextView;
>
> > >> > public class headerlist extends Activity implements
> > >> > View.OnClickListener
> > >> > {
> > >> >        private ListView                listView;
> > >> >         private List<String>    strings;
>
> > >> >       �...@override
> > >> >        public void onCreate(Bundle savedInstanceState)
> > >> >        {
> > >> >                super.onCreate(savedInstanceState);
> > >> >                setContentView(R.layout.main);
>
> > >> >                Button additem = (Button) findViewById(R.id.add_item);
> > >> >                Button deleteitem = (Button) findViewById
> > >> > (R.id.del_item);
>
> > >> >                 listView = (ListView) findViewById(R.id.listView);
>
> > >> >                additem.setOnClickListener(this);
> > >> >                deleteitem.setOnClickListener(this);
>
> > >> >                strings = new ArrayList<String>();
> > >> >                strings.add("First");
> > >> >                strings.add("Second");
> > >> >                strings.add("Third");
> > >> >                listView.setAdapter(new ArrayAdapter<String>(this,
> > >> > android.R.layout.simple_list_item_multiple_choice, strings));
> > >> >        }
>
> > >> >       �...@suppresswarnings("unchecked")
> > >> >       �...@override
> > >> >        public void onClick(View view)
> > >> >        {
> > >> >                if(view.getId() == R.id.add_item)
> > >> >                {
> > >> >                        strings.add("another one");
> > >> >                        ((ArrayAdapter<String>)
> > >> > ((HeaderViewListAdapter) listView.getAdapter()).getWrappedAdapter
> > >> > ()).notifyDataSetChanged();
> > >> >                }
> > >> >                else if(view.getId() == R.id.del_item)
> > >> >                {
> > >> >                        if(strings.size() > 0)
> > >> >                        {
> > >> >                                strings.remove(strings.size() - 1);
> > >> >                                ((ArrayAdapter<String>)
> > >> > ((HeaderViewListAdapter)listView.getAdapter()).getWrappedAdapter
> > >> > ()).notifyDataSetChanged();
> > >> >                        }
> > >> >                }
> > >> >        }
> > >> > }
>
> > >> > main.xml:
>
> > >> > <?xml version="1.0" encoding="utf-8"?>
> > >> > <AbsoluteLayout
> > >> > android:layout_width="fill_parent"
> > >> > android:layout_height="fill_parent"
> > >> > xmlns:android="http://schemas.android.com/apk/res/android";>
>
> > >> > <Button
> > >> > android:id="@+id/add_item"
> > >> > android:layout_width="120px"
> > >> > android:layout_height="wrap_content"
> > >> > android:text="Add Item"
> > >> > android:layout_x="0px"
> > >> > android:layout_y="0px"
>
> > >> > </Button>
>
> > >> > <Button
> > >> > android:id="@+id/del_item"
> > >> > android:layout_width="120px"
> > >> > android:layout_height="wrap_content"
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to