i have implemented a CursorTreeAdapter, and im using it to fetch data from a sqlite Database which contains information about days. Now i want those days to be grouped as months. for that i implemented a Cursor returning a list of Months + Years, and a child cursor that retrieves the days that are supposed to be in that group.
My group cursor seems to be running just fine, i get the mm.YYYY as a group header, at least on some older devices, tested it on a newer one and there it crashes for no obvious reasons. As it doesn't contain any code from my project, im not really sure about how to fix this.
12-12 12:54:38.671: E/AndroidRuntime(11329): FATAL EXCEPTION: main
12-12 12:54:38.671: E/AndroidRuntime(11329): java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.database.CursorWindow.nativeGetLong(Native Method)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.database.CursorWindow.getLong(CursorWindow.java:507)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:75)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.CursorTreeAdapter$MyCursorHelper.getId(CursorTreeAdapter.java:436)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.CursorTreeAdapter.getGroupId(CursorTreeAdapter.java:191)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.ExpandableListConnector.getItemId(ExpandableListConnector.java:422)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.AbsListView.obtainView(AbsListView.java:2180)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.ListView.onMeasure(ListView.java:1158)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1447)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-12 12:54:38.671: E/AndroidRuntime(11329): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2438)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.View.measure(View.java:15525)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.Choreographer.doFrame(Choreographer.java:532)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.os.Handler.handleCallback(Handler.java:725)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.os.Looper.loop(Looper.java:137)
12-12 12:54:38.671: E/AndroidRuntime(11329): at android.app.ActivityThread.main(ActivityThread.java:5227)
12-12 12:54:38.671: E/AndroidRuntime(11329): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 12:54:38.671: E/AndroidRuntime(11329): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 12:54:38.671: E/AndroidRuntime(11329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
12-12 12:54:38.671: E/AndroidRuntime(11329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
12-12 12:54:38.671: E/AndroidRuntime(11329): at dalvik.system.NativeStart.main(Native Method)
Anyway on an older device the header appears as intended. but throws a similar stacktrace when clicking the header. So my guess is that the newer phones tried to expand the Group for me without having to actually click it.
01-03 21:48:06.656: E/CursorWindow(16844): Bad request for field slot 0,-1. numRows = 1, numColumns = 2
01-03 21:48:06.656: W/dalvikvm(16844): threadid=1: thread exiting with uncaught exception (group=0x40018578)
01-03 21:48:06.664: E/AndroidRuntime(16844): FATAL EXCEPTION: main
01-03 21:48:06.664: E/AndroidRuntime(16844): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.database.CursorWindow.getLong_native(Native Method)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.database.CursorWindow.getLong(CursorWindow.java:412)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:108)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.CursorTreeAdapter$MyCursorHelper.getId(CursorTreeAdapter.java:437)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.CursorTreeAdapter.getGroupId(CursorTreeAdapter.java:192)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.ExpandableListConnector.getItemId(ExpandableListConnector.java:421)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.AdapterView.getItemIdAtPosition(AdapterView.java:745)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.AdapterView.setSelectedPositionInt(AdapterView.java:1088)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2744)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.widget.ListView.onTouchEvent(ListView.java:3669)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.View.dispatchTouchEvent(View.java:3885)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
01-03 21:48:06.664: E/AndroidRuntime(16844): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1769)
01-03 21:48:06.664: E/AndroidRuntime(16844): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1135)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
01-03 21:48:06.664: E/AndroidRuntime(16844): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1753)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2227)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.view.ViewRoot.handleMessage(ViewRoot.java:1886)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.os.Handler.dispatchMessage(Handler.java:99)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.os.Looper.loop(Looper.java:130)
01-03 21:48:06.664: E/AndroidRuntime(16844): at android.app.ActivityThread.main(ActivityThread.java:3687)
01-03 21:48:06.664: E/AndroidRuntime(16844): at java.lang.reflect.Method.invokeNative(Native Method)
01-03 21:48:06.664: E/AndroidRuntime(16844): at java.lang.reflect.Method.invoke(Method.java:507)
01-03 21:48:06.664: E/AndroidRuntime(16844): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-03 21:48:06.664: E/AndroidRuntime(16844): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-03 21:48:06.664: E/AndroidRuntime(16844): at dalvik.system.NativeStart.main(Native Method)
I have Checked other similar problems but there was at least one point at which the Stacktrace refereed to the actual workspace. But in this case i have no idea what i going on. All i can tell is that the getChildrenCursor of the CursorTreeAdapter has not been called at the point the app crashes because i added a println to the methods body.
And this is how i setup the group cursor, im not calling movetoFirst as thats supposed to managed by the CursorTreeAdapter and appears to work since it displays on header with proper content.
public Cursor getGroupCursor(){
SQLiteDatabase db = helper.getReadableDatabase();
String sqlQuery = "SELECT DISTINCT STRFTIME('%m', " + INTAKE_KEY_DATE
+ ") as month, STRFTIME('%Y', " + INTAKE_KEY_DATE + ") as year " +
"FROM " + TABLENAME_INTAKE;
return db.rawQuery(sqlQuery, null);
}
If you need any additional code, let me know
Found it,
The documentation states that every table has to have a column named _id, which mine doesnt. at least for now :)
Related
I get an error in my code with this logcat:
java.lang.NoClassDefFoundError: android.util.ArrayMap
at it.dd.multiplayerit.MainActivity.<init>(MainActivity.java:88)
at it.dd.multiplayerit.SwipeMainFragment$SectionsPagerAdapter.getItem(SwipeMainFragment.java:200)
at android.support.v4.app.FragmentPagerAdapter.instantiateItem(FragmentPagerAdapter.java:97)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:832)
at android.support.v4.view.ViewPager.populate(ViewPager.java:982)
at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)
at android.view.View.measure(View.java:15284)
at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.onMeasure(CustomViewAbove.java:456)
at android.view.View.measure(View.java:15284)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:665)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:447)
at android.view.View.measure(View.java:15284)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15284)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:861)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:602)
at android.view.View.measure(View.java:15284)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2367)
at android.view.View.measure(View.java:15284)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1111)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1292)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1009)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4236)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4872)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
I think that the problem is the autocompletetextview i created. I mapped the array to get the position of array when i click in the dropdown during type what i want search.
At line 88 i have this:
ArrayMap<String, Integer>myArrayMap = new ArrayMap<String, Integer>();
The crash seems to be only with android 4.1 version. Is there any incompatibility?
ArrayMap was introduced in Api level 19, but it was also released in the compatibility library v4, so it would be enough to change the import to android.support.v4.util.ArrayMap instead of android.util.ArrayMap
For now it migrates to AndroidX.
Instead of android.util.ArrayMap you will write androidx.collection.ArrayMap
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.map.googlemapv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.map.googlemapv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.map.googlemapv2.permission.MAPS_RECEIVE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.map.googlemapv2.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyXXXXXXXXXXXXXXXXXXXXXXXX" />
</application>
</manifest>
Layout File
<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=".MainActivity" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/btnSurrey" />
</RelativeLayout>
StackTrace :
12-12 06:19:45.460: D/AndroidRuntime(907): Shutting down VM
12-12 06:19:45.460: W/dalvikvm(907): threadid=1: thread exiting with uncaught exception (group=0xb4aeab90)
12-12 06:19:45.500: E/AndroidRuntime(907): FATAL EXCEPTION: main
12-12 06:19:45.500: E/AndroidRuntime(907): Process: com.amaps.androidmap, PID: 907
12-12 06:19:45.500: E/AndroidRuntime(907): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amaps.androidmap/com.amaps.androidmap.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.os.Handler.dispatchMessage(Handler.java:102)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.os.Looper.loop(Looper.java:137)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-12 06:19:45.500: E/AndroidRuntime(907): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 06:19:45.500: E/AndroidRuntime(907): at java.lang.reflect.Method.invoke(Method.java:515)
12-12 06:19:45.500: E/AndroidRuntime(907): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-12 06:19:45.500: E/AndroidRuntime(907): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-12 06:19:45.500: E/AndroidRuntime(907): at dalvik.system.NativeStart.main(Native Method)
12-12 06:19:45.500: E/AndroidRuntime(907): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
12-12 06:19:45.500: E/AndroidRuntime(907): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-12 06:19:45.500: E/AndroidRuntime(907): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Activity.setContentView(Activity.java:1928)
12-12 06:19:45.500: E/AndroidRuntime(907): at com.amaps.androidmap.MainActivity.onCreate(MainActivity.java:12)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Activity.performCreate(Activity.java:5243)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-12 06:19:45.500: E/AndroidRuntime(907): ... 11 more
12-12 06:19:45.500: E/AndroidRuntime(907): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Fragment.instantiate(Fragment.java:597)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Fragment.instantiate(Fragment.java:561)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Activity.onCreateView(Activity.java:4777)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
12-12 06:19:45.500: E/AndroidRuntime(907): ... 20 more
12-12 06:19:45.500: E/AndroidRuntime(907): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/com.amaps.androidmap-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.amaps.androidmap-2, /system/lib]]
12-12 06:19:45.500: E/AndroidRuntime(907): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-12 06:19:45.500: E/AndroidRuntime(907): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-12 06:19:45.500: E/AndroidRuntime(907): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-12 06:19:45.500: E/AndroidRuntime(907): at android.app.Fragment.instantiate(Fragment.java:583)
12-12 06:19:45.500: E/AndroidRuntime(907): ... 23 more
12-12 06:23:20.842: I/Process(907): Sending signal. PID: 907 SIG: 9
12-12 06:44:02.832: D/AndroidRuntime(1054): Shutting down VM
12-12 06:44:02.832: W/dalvikvm(1054): threadid=1: thread exiting with uncaught exception (group=0xb4aeab90)
12-12 06:44:02.852: E/AndroidRuntime(1054): FATAL EXCEPTION: main
12-12 06:44:02.852: E/AndroidRuntime(1054): Process: com.amaps.androidmap, PID: 1054
12-12 06:44:02.852: E/AndroidRuntime(1054): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amaps.androidmap/com.amaps.androidmap.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.os.Handler.dispatchMessage(Handler.java:102)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.os.Looper.loop(Looper.java:137)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-12 06:44:02.852: E/AndroidRuntime(1054): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 06:44:02.852: E/AndroidRuntime(1054): at java.lang.reflect.Method.invoke(Method.java:515)
12-12 06:44:02.852: E/AndroidRuntime(1054): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-12 06:44:02.852: E/AndroidRuntime(1054): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-12 06:44:02.852: E/AndroidRuntime(1054): at dalvik.system.NativeStart.main(Native Method)
12-12 06:44:02.852: E/AndroidRuntime(1054): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-12 06:44:02.852: E/AndroidRuntime(1054): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Activity.setContentView(Activity.java:1928)
12-12 06:44:02.852: E/AndroidRuntime(1054): at com.amaps.androidmap.MainActivity.onCreate(MainActivity.java:12)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Activity.performCreate(Activity.java:5243)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-12 06:44:02.852: E/AndroidRuntime(1054): ... 11 more
12-12 06:44:02.852: E/AndroidRuntime(1054): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Fragment.instantiate(Fragment.java:597)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Fragment.instantiate(Fragment.java:561)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Activity.onCreateView(Activity.java:4777)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
12-12 06:44:02.852: E/AndroidRuntime(1054): ... 21 more
12-12 06:44:02.852: E/AndroidRuntime(1054): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.amaps.androidmap-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.amaps.androidmap-1, /system/lib]]
12-12 06:44:02.852: E/AndroidRuntime(1054): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-12 06:44:02.852: E/AndroidRuntime(1054): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-12 06:44:02.852: E/AndroidRuntime(1054): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-12 06:44:02.852: E/AndroidRuntime(1054): at android.app.Fragment.instantiate(Fragment.java:583)
12-12 06:44:02.852: E/AndroidRuntime(1054): ... 24 more
12-12 06:49:03.212: I/Process(1054): Sending signal. PID: 1054 SIG: 9
12-12 06:58:53.742: D/AndroidRuntime(1100): Shutting down VM
12-12 06:58:53.742: W/dalvikvm(1100): threadid=1: thread exiting with uncaught exception (group=0xb4aeab90)
12-12 06:58:53.762: E/AndroidRuntime(1100): FATAL EXCEPTION: main
12-12 06:58:53.762: E/AndroidRuntime(1100): Process: com.amaps.androidmap, PID: 1100
12-12 06:58:53.762: E/AndroidRuntime(1100): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amaps.androidmap/com.amaps.androidmap.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.os.Handler.dispatchMessage(Handler.java:102)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.os.Looper.loop(Looper.java:137)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-12 06:58:53.762: E/AndroidRuntime(1100): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 06:58:53.762: E/AndroidRuntime(1100): at java.lang.reflect.Method.invoke(Method.java:515)
12-12 06:58:53.762: E/AndroidRuntime(1100): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-12 06:58:53.762: E/AndroidRuntime(1100): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-12 06:58:53.762: E/AndroidRuntime(1100): at dalvik.system.NativeStart.main(Native Method)
12-12 06:58:53.762: E/AndroidRuntime(1100): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-12 06:58:53.762: E/AndroidRuntime(1100): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Activity.setContentView(Activity.java:1928)
12-12 06:58:53.762: E/AndroidRuntime(1100): at com.amaps.androidmap.MainActivity.onCreate(MainActivity.java:12)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Activity.performCreate(Activity.java:5243)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-12 06:58:53.762: E/AndroidRuntime(1100): ... 11 more
12-12 06:58:53.762: E/AndroidRuntime(1100): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Fragment.instantiate(Fragment.java:597)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Fragment.instantiate(Fragment.java:561)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Activity.onCreateView(Activity.java:4777)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
12-12 06:58:53.762: E/AndroidRuntime(1100): ... 21 more
12-12 06:58:53.762: E/AndroidRuntime(1100): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.amaps.androidmap-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.amaps.androidmap-2, /system/lib]]
12-12 06:58:53.762: E/AndroidRuntime(1100): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-12 06:58:53.762: E/AndroidRuntime(1100): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-12 06:58:53.762: E/AndroidRuntime(1100): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-12 06:58:53.762: E/AndroidRuntime(1100): at android.app.Fragment.instantiate(Fragment.java:583)
12-12 06:58:53.762: E/AndroidRuntime(1100): ... 24 more
12-12 06:59:41.712: I/Process(1100): Sending signal. PID: 1100 SIG: 9
i import the library from path :
adt-bundle-linux-x86-20131030/sdk/extras/google/google_play_services/libproject//google-play-services_lib/
i also made the reference but still nothing happen.Dont knw what to do.
I suspect that you have not referenced to the google play services library project properly. Make sure you do that first.
<uses-sdk
android:minSdkVersion="8"
Your min sdk is 8. Use SupportMapFragment and extend FragmentActivity and use support library.
or change to api level to 12 and above.
You are also missing
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
in Application Tag of manifest
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
Make sure you have referenced google play services library project properly and followed all the steps in the above link
Replace it:
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/btnSurrey" />
with this:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
add this in maifest:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Your MapFragment should be defined like this.
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
Add this in AndroidManifest.xml
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
In my app there are no compilation errors when i tried to run my app on android device it shows App stopped unexpectedly error .i didn't find the exact problem in lohcat here i am pasting the logcat details any one please exaplain this.
12-12 00:39:20.240: I/dalvikvm(687): Could not find method com.google.inject.Injector.getInstance, referenced from method de.dan_nrw.android.scroid.DependencyInjector.getInstance
12-12 00:39:20.310: W/dalvikvm(687): VFY: unable to resolve interface method 3344: Lcom/google/inject/Injector;.getInstance (Ljava/lang/Class;)Ljava/lang/Object;
12-12 00:39:20.310: D/dalvikvm(687): VFY: replacing opcode 0x72 at 0x000e
12-12 00:39:20.320: E/dalvikvm(687): Could not find class 'com.google.inject.Module[]', referenced from method de.dan_nrw.android.scroid.DependencyInjector.init
12-12 00:39:20.370: W/dalvikvm(687): VFY: unable to resolve new-array 684 ([Lcom/google/inject/Module;) in Lde/dan_nrw/android/scroid/DependencyInjector;
12-12 00:39:20.370: D/dalvikvm(687): VFY: replacing opcode 0x23 at 0x0001
12-12 00:39:20.413: W/dalvikvm(687): Unable to resolve superclass of Lde/dan_nrw/android/scroid/ProductiveModule; (472)
12-12 00:39:20.450: W/dalvikvm(687): Link of class 'Lde/dan_nrw/android/scroid/ProductiveModule;' failed
12-12 00:39:20.450: D/dalvikvm(687): DexOpt: unable to opt direct call 0x0d30 at 0x06 in Lde/dan_nrw/android/scroid/DependencyInjector;.init
12-12 00:39:20.471: D/AndroidRuntime(687): Shutting down VM
12-12 00:39:20.471: W/dalvikvm(687): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
12-12 00:39:20.511: E/AndroidRuntime(687): FATAL EXCEPTION: main
12-12 00:39:20.511: E/AndroidRuntime(687): java.lang.NoClassDefFoundError: com.google.inject.Module[]
12-12 00:39:20.511: E/AndroidRuntime(687): at de.dan_nrw.android.scroid.DependencyInjector.init(DependencyInjector.java:37)
12-12 00:39:20.511: E/AndroidRuntime(687): at de.dan_nrw.android.scroid.ScroidWallpaperGallery.<init>(ScroidWallpaperGallery.java:84)
12-12 00:39:20.511: E/AndroidRuntime(687): at java.lang.Class.newInstanceImpl(Native Method)
12-12 00:39:20.511: E/AndroidRuntime(687): at java.lang.Class.newInstance(Class.java:1319)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.ActivityThread.access$600(ActivityThread.java:122)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.os.Looper.loop(Looper.java:137)
12-12 00:39:20.511: E/AndroidRuntime(687): at android.app.ActivityThread.main(ActivityThread.java:4340)
12-12 00:39:20.511: E/AndroidRuntime(687): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 00:39:20.511: E/AndroidRuntime(687): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 00:39:20.511: E/AndroidRuntime(687): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-12 00:39:20.511: E/AndroidRuntime(687): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-12 00:39:20.511: E/AndroidRuntime(687): at dalvik.system.NativeStart.main(Native Method)
12-12 00:39:23.931: I/Process(687): Sending signal. PID: 687 SIG: 9
12-12 00:44:23.441: I/dalvikvm(728): Could not find method com.google.inject.Injector.getInstance, referenced from method de.dan_nrw.android.scroid.DependencyInjector.getInstance
12-12 00:44:23.491: W/dalvikvm(728): VFY: unable to resolve interface method 3344: Lcom/google/inject/Injector;.getInstance (Ljava/lang/Class;)Ljava/lang/Object;
12-12 00:44:23.491: D/dalvikvm(728): VFY: replacing opcode 0x72 at 0x000e
12-12 00:44:23.491: E/dalvikvm(728): Could not find class 'com.google.inject.Module[]', referenced from method de.dan_nrw.android.scroid.DependencyInjector.init
12-12 00:44:23.491: W/dalvikvm(728): VFY: unable to resolve new-array 684 ([Lcom/google/inject/Module;) in Lde/dan_nrw/android/scroid/DependencyInjector;
12-12 00:44:23.491: D/dalvikvm(728): VFY: replacing opcode 0x23 at 0x0001
12-12 00:44:23.511: W/dalvikvm(728): Unable to resolve superclass of Lde/dan_nrw/android/scroid/ProductiveModule; (472)
12-12 00:44:23.521: W/dalvikvm(728): Link of class 'Lde/dan_nrw/android/scroid/ProductiveModule;' failed
12-12 00:44:23.551: D/dalvikvm(728): DexOpt: unable to opt direct call 0x0d30 at 0x06 in Lde/dan_nrw/android/scroid/DependencyInjector;.init
12-12 00:44:23.551: D/AndroidRuntime(728): Shutting down VM
12-12 00:44:23.561: W/dalvikvm(728): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
12-12 00:44:23.641: E/AndroidRuntime(728): FATAL EXCEPTION: main
12-12 00:44:23.641: E/AndroidRuntime(728): java.lang.NoClassDefFoundError: com.google.inject.Module[]
12-12 00:44:23.641: E/AndroidRuntime(728): at de.dan_nrw.android.scroid.DependencyInjector.init(DependencyInjector.java:37)
12-12 00:44:23.641: E/AndroidRuntime(728): at de.dan_nrw.android.scroid.ScroidWallpaperGallery.<init>(ScroidWallpaperGallery.java:84)
12-12 00:44:23.641: E/AndroidRuntime(728): at java.lang.Class.newInstanceImpl(Native Method)
12-12 00:44:23.641: E/AndroidRuntime(728): at java.lang.Class.newInstance(Class.java:1319)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.ActivityThread.access$600(ActivityThread.java:122)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.os.Looper.loop(Looper.java:137)
12-12 00:44:23.641: E/AndroidRuntime(728): at android.app.ActivityThread.main(ActivityThread.java:4340)
12-12 00:44:23.641: E/AndroidRuntime(728): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 00:44:23.641: E/AndroidRuntime(728): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 00:44:23.641: E/AndroidRuntime(728): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-12 00:44:23.641: E/AndroidRuntime(728): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-12 00:44:23.641: E/AndroidRuntime(728): at dalvik.system.NativeStart.main(Native Method)
It could be you forgot to add a necessary jar to the build path
When I run my android application it gives an error "The application has stopped working,please try again". Please help me to solve this problem. i have created a method which gets called when the button gets clicked. When I include the code for calling another class in this method it shows the above error & when I remove that code it neither shows the error nor goes ahead when listview etc. gets clicked. Can you please check my code and help me please.
CODE:
public void myClickHandler(View view)
{
//Toast.makeText(this, "yesss",Toast.LENGTH_LONG).show();
setContentView(R.layout.screen1);
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, city);
ListView FirstProjectActivity = (ListView) findViewById(R.id.mylist1);
FirstProjectActivity.setAdapter(adapter);
Intent myIntent = new Intent(FirstProjectActivity.this,
City.class);
FirstProjectActivity.this.startActivity(myIntent);
//startActivity(new Intent(FirstProjectActivity.this, City.class));
}
LOGCAT is as follows:
03-02 18:56:28.136: D/AndroidRuntime(316): Shutting down VM
03-02 18:56:28.136: W/dalvikvm(316): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-02 18:56:28.226: E/AndroidRuntime(316): FATAL EXCEPTION: main
03-02 18:56:28.226: E/AndroidRuntime(316): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstProject/com.example.FirstProject.FirstProjectActivity}: java.lang.NullPointerException
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.os.Handler.dispatchMessage(Handler.java:99)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.os.Looper.loop(Looper.java:123)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-02 18:56:28.226: E/AndroidRuntime(316): at java.lang.reflect.Method.invokeNative(Native Method)
03-02 18:56:28.226: E/AndroidRuntime(316): at java.lang.reflect.Method.invoke(Method.java:521)
03-02 18:56:28.226: E/AndroidRuntime(316): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-02 18:56:28.226: E/AndroidRuntime(316): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-02 18:56:28.226: E/AndroidRuntime(316): at dalvik.system.NativeStart.main(Native Method)
03-02 18:56:28.226: E/AndroidRuntime(316): Caused by: java.lang.NullPointerException
03-02 18:56:28.226: E/AndroidRuntime(316): at com.example.FirstProject.FirstProjectActivity.onCreate(FirstProjectActivity.java:37)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-02 18:56:28.226: E/AndroidRuntime(316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-02 18:56:28.226: E/AndroidRuntime(316): ... 11 more
03-02 18:56:35.396: I/Process(316): Sending signal. PID: 316 SIG: 9
03-02 19:02:51.836: D/AndroidRuntime(351): Shutting down VM
03-02 19:02:51.836: W/dalvikvm(351): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-02 19:02:51.866: E/AndroidRuntime(351): FATAL EXCEPTION: main
03-02 19:02:51.866: E/AndroidRuntime(351): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstProject/com.example.FirstProject.FirstProjectActivity}: java.lang.NullPointerException
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.os.Handler.dispatchMessage(Handler.java:99)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.os.Looper.loop(Looper.java:123)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-02 19:02:51.866: E/AndroidRuntime(351): at java.lang.reflect.Method.invokeNative(Native Method)
03-02 19:02:51.866: E/AndroidRuntime(351): at java.lang.reflect.Method.invoke(Method.java:521)
03-02 19:02:51.866: E/AndroidRuntime(351): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-02 19:02:51.866: E/AndroidRuntime(351): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-02 19:02:51.866: E/AndroidRuntime(351): at dalvik.system.NativeStart.main(Native Method)
03-02 19:02:51.866: E/AndroidRuntime(351): Caused by: java.lang.NullPointerException
03-02 19:02:51.866: E/AndroidRuntime(351): at com.example.FirstProject.FirstProjectActivity.onCreate(FirstProjectActivity.java:37)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-02 19:02:51.866: E/AndroidRuntime(351): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-02 19:02:51.866: E/AndroidRuntime(351): ... 11 more
03-02 19:03:03.647: I/Process(351): Sending signal. PID: 351 SIG: 9
03-02 20:11:17.722: W/KeyCharacterMap(379): No keyboard for id 0
03-02 20:11:17.926: W/KeyCharacterMap(379): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
03-02 20:11:28.441: D/dalvikvm(379): GC_EXPLICIT freed 3121 objects / 172672 bytes in 1696ms
03-03 01:03:02.696: W/KeyCharacterMap(406): No keyboard for id 0
03-03 01:03:02.696: W/KeyCharacterMap(406): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
03-03 01:03:08.566: D/dalvikvm(406): GC_EXPLICIT freed 2874 objects / 162408 bytes in 192ms
03-03 01:33:06.566: D/AndroidRuntime(432): Shutting down VM
03-03 01:33:06.566: W/dalvikvm(432): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-03 01:33:06.726: E/AndroidRuntime(432): FATAL EXCEPTION: main
03-03 01:33:06.726: E/AndroidRuntime(432): java.lang.IllegalStateException: Could not execute method of the activity
03-03 01:33:06.726: E/AndroidRuntime(432): at android.view.View$1.onClick(View.java:2072)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.view.View.performClick(View.java:2408)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.view.View$PerformClick.run(View.java:8816)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.os.Handler.handleCallback(Handler.java:587)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.os.Handler.dispatchMessage(Handler.java:92)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.os.Looper.loop(Looper.java:123)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 01:33:06.726: E/AndroidRuntime(432): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:33:06.726: E/AndroidRuntime(432): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:33:06.726: E/AndroidRuntime(432): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 01:33:06.726: E/AndroidRuntime(432): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 01:33:06.726: E/AndroidRuntime(432): at dalvik.system.NativeStart.main(Native Method)
03-03 01:33:06.726: E/AndroidRuntime(432): Caused by: java.lang.reflect.InvocationTargetException
03-03 01:33:06.726: E/AndroidRuntime(432): at com.example.FirstProject.FirstProjectActivity.myClickHandler(FirstProjectActivity.java:69)
03-03 01:33:06.726: E/AndroidRuntime(432): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:33:06.726: E/AndroidRuntime(432): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.view.View$1.onClick(View.java:2067)
03-03 01:33:06.726: E/AndroidRuntime(432): ... 11 more
03-03 01:33:06.726: E/AndroidRuntime(432): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.FirstProject/com.example.FirstProject.City}; have you declared this activity in your AndroidManifest.xml?
03-03 01:33:06.726: E/AndroidRuntime(432): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.app.Activity.startActivityForResult(Activity.java:2817)
03-03 01:33:06.726: E/AndroidRuntime(432): at android.app.Activity.startActivity(Activity.java:2923)
03-03 01:33:06.726: E/AndroidRuntime(432): ... 15 more
03-03 01:33:08.956: I/Process(432): Sending signal. PID: 432 SIG: 9
03-03 01:34:05.387: D/AndroidRuntime(460): Shutting down VM
03-03 01:34:05.387: W/dalvikvm(460): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-03 01:34:05.417: E/AndroidRuntime(460): FATAL EXCEPTION: main
03-03 01:34:05.417: E/AndroidRuntime(460): java.lang.IllegalStateException: Could not execute method of the activity
03-03 01:34:05.417: E/AndroidRuntime(460): at android.view.View$1.onClick(View.java:2072)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.view.View.performClick(View.java:2408)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.view.View$PerformClick.run(View.java:8816)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.os.Handler.handleCallback(Handler.java:587)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.os.Handler.dispatchMessage(Handler.java:92)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.os.Looper.loop(Looper.java:123)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 01:34:05.417: E/AndroidRuntime(460): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:34:05.417: E/AndroidRuntime(460): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:34:05.417: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 01:34:05.417: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 01:34:05.417: E/AndroidRuntime(460): at dalvik.system.NativeStart.main(Native Method)
03-03 01:34:05.417: E/AndroidRuntime(460): Caused by: java.lang.reflect.InvocationTargetException
03-03 01:34:05.417: E/AndroidRuntime(460): at com.example.FirstProject.FirstProjectActivity.myClickHandler(FirstProjectActivity.java:70)
03-03 01:34:05.417: E/AndroidRuntime(460): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:34:05.417: E/AndroidRuntime(460): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.view.View$1.onClick(View.java:2067)
03-03 01:34:05.417: E/AndroidRuntime(460): ... 11 more
03-03 01:34:05.417: E/AndroidRuntime(460): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.FirstProject/com.example.FirstProject.City}; have you declared this activity in your AndroidManifest.xml?
03-03 01:34:05.417: E/AndroidRuntime(460): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.app.Activity.startActivityForResult(Activity.java:2817)
03-03 01:34:05.417: E/AndroidRuntime(460): at android.app.Activity.startActivity(Activity.java:2923)
03-03 01:34:05.417: E/AndroidRuntime(460): ... 15 more
03-03 01:34:11.016: I/Process(460): Sending signal. PID: 460 SIG: 9
03-03 01:35:33.547: D/AndroidRuntime(490): Shutting down VM
03-03 01:35:33.557: W/dalvikvm(490): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-03 01:35:33.577: E/AndroidRuntime(490): FATAL EXCEPTION: main
03-03 01:35:33.577: E/AndroidRuntime(490): java.lang.IllegalStateException: Could not execute method of the activity
03-03 01:35:33.577: E/AndroidRuntime(490): at android.view.View$1.onClick(View.java:2072)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.view.View.performClick(View.java:2408)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.view.View$PerformClick.run(View.java:8816)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.os.Handler.handleCallback(Handler.java:587)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.os.Handler.dispatchMessage(Handler.java:92)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.os.Looper.loop(Looper.java:123)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 01:35:33.577: E/AndroidRuntime(490): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:35:33.577: E/AndroidRuntime(490): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:35:33.577: E/AndroidRuntime(490): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 01:35:33.577: E/AndroidRuntime(490): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 01:35:33.577: E/AndroidRuntime(490): at dalvik.system.NativeStart.main(Native Method)
03-03 01:35:33.577: E/AndroidRuntime(490): Caused by: java.lang.reflect.InvocationTargetException
03-03 01:35:33.577: E/AndroidRuntime(490): at com.example.FirstProject.FirstProjectActivity.myClickHandler(FirstProjectActivity.java:70)
03-03 01:35:33.577: E/AndroidRuntime(490): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:35:33.577: E/AndroidRuntime(490): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.view.View$1.onClick(View.java:2067)
03-03 01:35:33.577: E/AndroidRuntime(490): ... 11 more
03-03 01:35:33.577: E/AndroidRuntime(490): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.FirstProject/com.example.FirstProject.City}; have you declared this activity in your AndroidManifest.xml?
03-03 01:35:33.577: E/AndroidRuntime(490): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.app.Activity.startActivityForResult(Activity.java:2817)
03-03 01:35:33.577: E/AndroidRuntime(490): at android.app.Activity.startActivity(Activity.java:2923)
03-03 01:35:33.577: E/AndroidRuntime(490): ... 15 more
03-03 01:35:39.176: I/Process(490): Sending signal. PID: 490 SIG: 9
03-03 01:36:06.947: D/AndroidRuntime(517): Shutting down VM
03-03 01:36:06.947: W/dalvikvm(517): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-03 01:36:06.967: E/AndroidRuntime(517): FATAL EXCEPTION: main
03-03 01:36:06.967: E/AndroidRuntime(517): java.lang.IllegalStateException: Could not execute method of the activity
03-03 01:36:06.967: E/AndroidRuntime(517): at android.view.View$1.onClick(View.java:2072)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.view.View.performClick(View.java:2408)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.view.View$PerformClick.run(View.java:8816)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.os.Handler.handleCallback(Handler.java:587)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.os.Handler.dispatchMessage(Handler.java:92)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.os.Looper.loop(Looper.java:123)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 01:36:06.967: E/AndroidRuntime(517): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:36:06.967: E/AndroidRuntime(517): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:36:06.967: E/AndroidRuntime(517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 01:36:06.967: E/AndroidRuntime(517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 01:36:06.967: E/AndroidRuntime(517): at dalvik.system.NativeStart.main(Native Method)
03-03 01:36:06.967: E/AndroidRuntime(517): Caused by: java.lang.reflect.InvocationTargetException
03-03 01:36:06.967: E/AndroidRuntime(517): at com.example.FirstProject.FirstProjectActivity.myClickHandler(FirstProjectActivity.java:70)
03-03 01:36:06.967: E/AndroidRuntime(517): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 01:36:06.967: E/AndroidRuntime(517): at java.lang.reflect.Method.invoke(Method.java:521)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.view.View$1.onClick(View.java:2067)
03-03 01:36:06.967: E/AndroidRuntime(517): ... 11 more
03-03 01:36:06.967: E/AndroidRuntime(517): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.FirstProject/com.example.FirstProject.City}; have you declared this activity in your AndroidManifest.xml?
03-03 01:36:06.967: E/AndroidRuntime(517): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.app.Activity.startActivityForResult(Activity.java:2817)
03-03 01:36:06.967: E/AndroidRuntime(517): at android.app.Activity.startActivity(Activity.java:2923)
03-03 01:36:06.967: E/AndroidRuntime(517): ... 15 more
03-03 01:36:13.306: I/Process(517): Sending signal. PID: 517 SIG: 9
When you want to detect if you click on an item you need to implement the onItemClickedListener i will give you an example below like i would do it:
listView.setOnItemClickListener(new MyOnitemClickListener());
//no i make my own class that impelemnts the onitemclicklistener
public class MyOnitemClickListener implements OnItemClickListener {
private int position = 0;
public void onItemClick(AdapterView<?> parent, View view, int pos,
long lat) {
// clicked on parent.getid()
if (parent.getId() == R.id.listView) {
//do something
}
}
}
after a crash, try looking for the first couple of red lines the LOGCAT spews to you as they usually explain what happened.
the following line :
java.lang.NullPointerException
(in line 5) showed up on you log, it usually means your trying to use an uninitialized object.
refer to:
What is a NullPointerException, and how do I fix it?
What's the reason for this error? I only get the error at certain times when I press the textview.
12 12:30:24.301: ERROR/AndroidRuntime(380): java.lang.NullPointerException
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at gps.app.tkartor.Tkartor.onClick(Tkartor.java:195)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.view.View.performClick(View.java:2408)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.view.View$PerformClick.run(View.java:8816)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.os.Handler.handleCallback(Handler.java:587)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.os.Looper.loop(Looper.java:123)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at java.lang.reflect.Method.invoke(Method.java:521)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-12 12:30:24.301: ERROR/AndroidRuntime(380): at dalvik.system.NativeStart.main(Native Method)
<TextView android:id="#+id/tvReload" style="#style/ButtonText"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:text="PRESS TO RELOAD"
android:textStyle="bold" android:layout_alignParentBottom="true"
android:textSize="12sp" android:clickable="true" />
java.lang.NullPointerException
Occurs when your object is null or not initiallized & you are trying to access it.
Crosscheck whether all your objects are properly initialized.
Specially in your code Check line number 195 of Tkartor.java file, there you have atleast one object null.