android custom list view position and click event issue(list getting dynamic data from server)
<p>I need a help more.Actually i am facing a problem for my listview that is getting new data after each 3 seconds as i asked you was working fine now.but there is a problem when i click on the listrow (launch the new activity show the visitordetail page) i am passing some data from listview row to another activity.my problem is that listview is getting new data  after each 3 seconds when  i click the listrow then next activity started and show the visitordetail page in the case update method is called before clicking the listview row but if i click the row and same time new data is received and added to row that app is crashed.</p>

<p>what should i do that my app is not crashed and work fine when click on row or row's button.i passing sessiontext and iptext related to that row to next activity.</p>

<p>my class code is following the link given below.
<a href="http://www.coderanch.com/t/568877/Android/Mobile/android-custom-list-view-position#2585198" rel="nofollow">http://www.coderanch.com/t/568877/Android/Mobile/android-custom-list-view-position#2585198</a>
eranch.com/t/568803/Android/Mobile/start-new-activity-when-click</p>

<p>one thing i more want with  my app  when i click on listiview row update list method is stopped and new activity is started and when i come back by from new activity the update method is again started how can this possible?</p>

<p>when i am coming back to next activty my logcat is like the following.............</p>

<pre><code>02-29 12:53:53.463: E/AndroidRuntime(5066): FATAL EXCEPTION: main
02-29 12:53:53.463: E/AndroidRuntime(5066): java.lang.RuntimeException: Unable to resume activity {com.live2support/com.live2support.L2STest}: java.lang.IllegalStateException: Timer was cancelled
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.os.Looper.loop(Looper.java:123)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at java.lang.reflect.Method.invokeNative(Native Method)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at java.lang.reflect.Method.invoke(Method.java:521)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at dalvik.system.NativeStart.main(Native Method)
02-29 12:53:53.463: E/AndroidRuntime(5066): Caused by: java.lang.IllegalStateException: Timer was cancelled
02-29 12:53:53.463: E/AndroidRuntime(5066):     at java.util.Timer.scheduleImpl(Timer.java:566)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at java.util.Timer.schedule(Timer.java:485)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at com.live2support.BaseActivity.onStart(BaseActivity.java:157)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at com.live2support.BaseActivity.onRestart(BaseActivity.java:932)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.Instrumentation.callActivityOnRestart(Instrumentation.java:1139)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.Activity.performRestart(Activity.java:3805)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread.performRestartActivity(ActivityThread.java:3477)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:160)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.LocalActivityManager.dispatchResume(LocalActivityManager.java:518)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityGroup.onResume(ActivityGroup.java:58)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.Activity.performResume(Activity.java:3823)
02-29 12:53:53.463: E/AndroidRuntime(5066):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
</code></pre>

<p>when i am click listrow app is crashing in that case new data update call is started and i purged the timer and code of my event like this crashing my app sometime.........</p>

<p>convertView.setOnClickListener(new OnClickListener(){</p>

<pre><code>                    public void onClick(View v) {
                        timer.purge();
                        if(SessionText.get(position)!=null&amp;&amp;IPText.get(position)!=null){
                        Intent i=new Intent(BaseActivity.this,VisitorDetail.class);
                        i.putExtra("ID", id);
                        i.putExtra("Position",position);
                        i.putExtra("From", from);
                        i.putExtra("SessionText", SessionText.get(position));
                        i.putExtra("IPTEXT",IPText.get(position));
                        startActivity(i);

                        }

                        else{

                            timer.schedule(new TimerTask() {
                                public void run() {
                                    TimerMethod();
                                }

                            }, 0, 3000); 
                        }



                    }});
</code></pre>

<p>anyone can help me to solved out the issue.....................</p>
