What is this error, why does it happen? - android

10-21 13:54:55.337: E/WindowManager(5921): Activity org.acra.CrashReportDialog has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView{42467520 V.E..... R.....I. 0,0-0,0} that was originally added here
10-21 13:54:55.337:
E/WindowManager(5921): android.view.WindowLeaked: Activity org.acra.CrashReportDialog has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView{42467520 V.E..... R.....I. 0,0-0,0} that was originally added here
10-21 13:54:55.337:
E/WindowManager(5921): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
10-21 13:54:55.337: E/WindowManager(5921): at
android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
10-21 13:54:55.337: E/WindowManager(5921): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Dialog.show(Dialog.java:281)
10-21 13:54:55.337: E/WindowManager(5921): at
org.acra.CrashReportDialog.onCreate(CrashReportDialog.java:76)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Activity.performCreate(Activity.java:5104)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-21 13:54:55.337: E/WindowManager(5921): at
android.os.Handler.dispatchMessage(Handler.java:99)
10-21 13:54:55.337: E/WindowManager(5921): at android.os.Looper.loop(Looper.java:137) 10-21
13:54:55.337: E/WindowManager(5921): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-21 13:54:55.337: E/WindowManager(5921):
at java.lang.reflect.Method.invokeNative(Native Method)
10-21 13:54:55.337: E/WindowManager(5921): at
java.lang.reflect.Method.invoke(Method.java:511)
10-21 13:54:55.337: E/WindowManager(5921): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-21 13:54:55.337: E/WindowManager(5921): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-21 13:54:55.337: E/WindowManager(5921): at
dalvik.system.NativeStart.main(Native Method)

Use below in the initialization of dialog -
Dialog mDialog= new Dialog(YourActivityName.this);

You're leaking your Window. This happens when your Activity creates the Dialog and you try recreating the Dialog instead of re-using your old dialog/dismiss that previous dialog.

Related

InflateException i have an Error inflating class

I have more activities and i dont have any problem but when i'm starting this activity(Segunda) it break
In this Activity I try to use a customView for zoom and draw, and i cant find where is the problem
this is the activity
public class Segunda extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_segunda);
//setContentView(new Panel(this));
setContentView(R.layout.activity_segunda);
}
}
this is the xml layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.andres.sun4all.Panel
android:id="#+id/Panelillo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight = "2">
</LinearLayout>
Logcat:
10-21 12:43:58.191: E/AndroidRuntime(27794): FATAL EXCEPTION: main
10-21 12:43:58.191: E/AndroidRuntime(27794): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andres.sun4all/com.andres.sun4all.Segunda}: android.view.InflateException: Binary XML file line #7: Error inflating class com.andres.sun4all.Panel
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread.access$600(ActivityThread.java:140)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.os.Looper.loop(Looper.java:137)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread.main(ActivityThread.java:4898)
10-21 12:43:58.191: E/AndroidRuntime(27794): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 12:43:58.191: E/AndroidRuntime(27794): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 12:43:58.191: E/AndroidRuntime(27794): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
10-21 12:43:58.191: E/AndroidRuntime(27794): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
10-21 12:43:58.191: E/AndroidRuntime(27794): at dalvik.system.NativeStart.main(Native Method)
10-21 12:43:58.191: E/AndroidRuntime(27794): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.andres.sun4all.Panel
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-21 12:43:58.191: E/AndroidRuntime(27794): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:308)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.Activity.setContentView(Activity.java:1924)
10-21 12:43:58.191: E/AndroidRuntime(27794): at com.andres.sun4all.Segunda.onCreate(Segunda.java:13)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.Activity.performCreate(Activity.java:5206)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
10-21 12:43:58.191: E/AndroidRuntime(27794): ... 11 more
10-21 12:43:58.191: E/AndroidRuntime(27794): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
10-21 12:43:58.191: E/AndroidRuntime(27794): at java.lang.Class.getConstructorOrMethod(Class.java:460)
10-21 12:43:58.191: E/AndroidRuntime(27794): at java.lang.Class.getConstructor(Class.java:431)
10-21 12:43:58.191: E/AndroidRuntime(27794): at android.view.LayoutInflater.createView(LayoutInflater.java:561)
10-21 12:43:58.191: E/AndroidRuntime(27794): ... 22 more
thanks for your help!
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
it means that your custom view Panel is missing the constructor with the context and attributeset:
public void Panel(Context context, AttributeSet att) {
super(context,att)
}
which is used when the custom view is inflated from the xml

osmdroid and display map

I can't display my map from Mapnik and I don't know what's the problem.
Can someone help me please! I need help!
here are my logs and my program
MainActivity
package com.formation.mapnick;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
//import android.view.Menu;
//import android.view.MenuItem;
public class MainActivity extends Activity {
//the MapView variable:
private MapView m_mapView;
private int MAP_DEFAULT_ZOOM = 15;
private double MAP_DEFAULT_LATITUDE = 49.292531;
private double MAP_DEFAULT_LONGITUDE = -12.276610;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Find the MapView controller in that layout
m_mapView = (MapView) findViewById(R.id.mapview);
m_mapView.setBuiltInZoomControls(true);
m_mapView.setClickable(true);
m_mapView.setMultiTouchControls(true);
m_mapView.setUseDataConnection(true);
m_mapView.getController().setZoom(MAP_DEFAULT_ZOOM);
m_mapView.getController().setCenter(new GeoPoint(MAP_DEFAULT_LATITUDE,MAP_DEFAULT_LONGITUDE));
m_mapView.setTileSource(TileSourceFactory.MAPNIK);
}
}
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.formation.mapnick"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="20" />
<supports-screens
android:anyDensity="true"
android:resizeable="false"
android:largeScreens="true"
android:normalScreens="true"
/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
my activity_main.xml
<RelativeLayout 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="${relativePackage}.${activityClass}" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<org.osmdroid.views.MapView
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="#string/apiKey"
/>
</RelativeLayout>
an my logs:
10-21 08:24:42.709: E/Trace(1112): error opening trace file: No such file or directory (2)
10-21 08:24:43.180: E/dalvikvm(1112): Could not find class 'org.osmdroid.views.MapView', referenced from method com.formation.mapnick.MainActivity.onCreate
10-21 08:24:43.199: W/dalvikvm(1112): VFY: unable to resolve check-cast 979 (Lorg/osmdroid/views/MapView;) in Lcom/formation/mapnick/MainActivity;
10-21 08:24:43.199: D/dalvikvm(1112): VFY: replacing opcode 0x1f at 0x000f
10-21 08:24:43.229: D/dalvikvm(1112): DexOpt: unable to opt direct call 0x18bf at 0x3e in Lcom/formation/mapnick/MainActivity;.onCreate
10-21 08:24:43.609: D/AndroidRuntime(1112): Shutting down VM
10-21 08:24:43.609: W/dalvikvm(1112): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-21 08:24:43.661: E/AndroidRuntime(1112): FATAL EXCEPTION: main
10-21 08:24:43.661: E/AndroidRuntime(1112): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.formation.mapnick/com.formation.mapnick.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class org.osmdroid.views.MapView
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.os.Looper.loop(Looper.java:137)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-21 08:24:43.661: E/AndroidRuntime(1112): at dalvik.system.NativeStart.main(Native Method)
10-21 08:24:43.661: E/AndroidRuntime(1112): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class org.osmdroid.views.MapView
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Activity.setContentView(Activity.java:1881)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.formation.mapnick.MainActivity.onCreate(MainActivity.java:24)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Activity.performCreate(Activity.java:5104)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-21 08:24:43.661: E/AndroidRuntime(1112): ... 11 more
10-21 08:24:43.661: E/AndroidRuntime(1112): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.osmdroid.views.MapView" on path: /data/app/com.formation.mapnick-1.apk
10-21 08:24:43.661: E/AndroidRuntime(1112): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
10-21 08:24:43.661: E/AndroidRuntime(1112): ... 21 more
10-21 08:24:48.429: I/Process(1112): Sending signal. PID: 1112 SIG: 9
any idea? I have already tested it on a phone but no result!

Activity is leaking a window

I am new to Android technology, and I am creating a practice app. I have created a mail sending class that is used in two Activities. In one Activity it is working fine, but in the other it is not working -- there is an error in the logcat and I am unable to find what is causing it. Here is the error log:
03-19 12:11:23.773: E/WindowManager(891): Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): android.view.WindowLeaked: Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-19 12:11:23.773: E/WindowManager(891): at android.app.Dialog.show(Dialog.java:281)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity$CountDownTask.onPreExecute(MainActivity.java:289)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.execute(AsyncTask.java:534)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity.CallLogsBackup(MainActivity.java:91)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$1.onClick(View.java:3592)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View.performClick(View.java:4202)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$PerformClick.run(View.java:17340)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.handleCallback(Handler.java:725)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.dispatchMessage(Handler.java:92)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Looper.loop(Looper.java:137)
03-19 12:11:23.773: E/WindowManager(891): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-19 12:11:23.773: E/WindowManager(891): at dalvik.system.NativeStart.main(Native Method)

Make Commonsware TouchListView functional in a TabGroup activity

when I run my project with the Commonsware TouchListView inside a TabGroupActivity, I can see the ListView but when I try to Drag an item the app crashes. I have this in the log :
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): FATAL EXCEPTION: main
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord#4099bfd0 is not valid; is your activity running?
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewRoot.setView(ViewRoot.java:527)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.Window$LocalWindowManager.addView(Window.java:424)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.commonsware.cwac.tlv.TouchListView.startDragging(TouchListView.java:419)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.commonsware.cwac.tlv.TouchListView.onInterceptTouchEvent(TouchListView.java:176)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:848)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.os.Looper.loop(Looper.java:130)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at java.lang.reflect.Method.invoke(Method.java:507)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-21 11:21:50.433: ERROR/AndroidRuntime(23139): at dalvik.system.NativeStart.main(Native Method)
I do not support activities-in-tabs for any of the CWAC components. It is an officially deprecated technique. It was never a very good idea in the first place, IMHO.
The TouchListView code comes from an Android open source application that does not use tabs in the activity with the drag-and-drop. The technique it uses for the drag indicator -- adding it as a view to the Window -- probably does not work for activities-in-tabs. It may work if you set up your tabs to have views as their contents, as you can see in this sample project.

Memory/Thread related Crash on Orientation change?

Friends,
onCreate() I am loading data from webservice using Async thread.
when thread is started it shows progress bar on screen and loads data.
A sudden problem I have faced is when I start that activity progress bar is shown I change orientation of my phone second thread starts &
Application crashes.(Inovation Target Exception something like that).
Here is the log cat any one guide me what is the solution to this problem?
Code is simple
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.searchbanks);
threadBank = new AsyncBanks();
threadBank.execute("","");
}
04-29 16:08:26.811: ERROR/WindowManager(430): Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): android.view.WindowLeaked: Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.ViewRoot.<init>(ViewRoot.java:247)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Dialog.show(Dialog.java:241)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks$AsyncBanks.onPreExecute(SearchBanks.java:133)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.AsyncTask.execute(AsyncTask.java:391)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.LoadRecords(SearchBanks.java:115)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.onCreate(SearchBanks.java:76)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:26.811: ERROR/WindowManager(430): at dalvik.system.NativeStart.main(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): java.lang.IllegalArgumentException: View not attached to window manager
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.Window$LocalWindowManager.removeView(Window.java:432)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismissDialog(Dialog.java:278)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.access$000(Dialog.java:71)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog$1.run(Dialog.java:111)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismiss(Dialog.java:268)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:197)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:1)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.finish(AsyncTask.java:417)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.access$300(AsyncTask.java:127)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at dalvik.system.NativeStart.main(Native Method)
Even if you dismiss your dialog so that you can recreate it, there seems to be a race condition between the system destroying the dialog and the lifecycle methods where you would dismiss it. Very rarely I get a crash report about dismissing a non-existent dialog at configuration change time.
I suggest catching and ignoring the exception in Dialog.dismiss() just to handle the race condition. That's what I've done and it's cleared up my problem.
Steve # WhitneyApps
Finally i got answer myself.
How to deal with orientation change with a ProgressDialog showing?
And
How to handle Activity when Orientation changes?

Categories

Resources