App crash, How to resolve? - android

I have a problem when I run my app and select an item from my spinner instead of opening a new class like it is supposed to the app crashes, I was wondering if anyone could help me with why this is happening. I am not sure what part of the code to include, so I will include the Logcat and if you request any code I will edit this post.
Thanks.
Logcat:
03-09 15:36:53.814: E/AndroidRuntime(13429): FATAL EXCEPTION: main
03-09 15:36:53.814: E/AndroidRuntime(13429): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.famouspeople/com.example.famouspeople.SeanConnery}: java.lang.NullPointerException
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.access$600(ActivityThread.java:140)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.os.Looper.loop(Looper.java:137)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-09 15:36:53.814: E/AndroidRuntime(13429): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 15:36:53.814: E/AndroidRuntime(13429): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-09 15:36:53.814: E/AndroidRuntime(13429): at dalvik.system.NativeStart.main(Native Method)
03-09 15:36:53.814: E/AndroidRuntime(13429): Caused by: java.lang.NullPointerException
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.example.famouspeople.SeanConnery.initialize(SeanConnery.java:44)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.example.famouspeople.SeanConnery.onCreate(SeanConnery.java:28)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.Activity.performCreate(Activity.java:5206)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
03-09 15:36:53.814: E/AndroidRuntime(13429): ... 11 more

Normally when app crashes with the click on spinner, the problem lies with the adapter you are using to populate the spinner, check carefully the length of apapter you defined. Follow this code
int num = SpinnerData.length;
SpinnerData = new String[num];
Log.d("ArrayAdapter",""+ SpinnerData.length);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(CurrentActivity.this, android.R.layout.simple_list_item_1, SpinnerData);
//spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);
check carefully length ..I hope this help

Related

Android application Error Opening Trace File: No such file or directory

Here is a link to a question i posted before with my code:
https://stackoverflow.com/questions/22277864/grid-view-open-one-layout-form-another-causes-the-prograam-to-crash
The error happens right as I click on the button2 'Ornaments' on the main form .
Log Cat:
03-09 10:08:20.308: E/Trace(640): error opening trace file: No such file or directory (2)
03-09 10:08:21.158: D/libEGL(640): loaded /system/lib/egl/libEGL_emulation.so
03-09 10:08:21.158: D/(640): HostConnection::get() New Host Connection established 0x2a072918, tid 640
03-09 10:08:21.218: D/libEGL(640): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-09 10:08:21.229: D/libEGL(640): loaded /system/lib/egl/libGLESv2_emulation.so
03-09 10:08:21.338: W/EGL_emulation(640): eglSurfaceAttrib not implemented
03-09 10:08:21.378: D/OpenGLRenderer(640): Enabling debug mode 0
03-09 10:08:26.648: D/dalvikvm(640): GC_FOR_ALLOC freed 125K, 3% free 8250K/8455K, paused 118ms, total 130ms
03-09 10:08:26.648: I/dalvikvm-heap(640): Forcing collection of SoftReferences for 31961104-byte allocation
03-09 10:08:26.838: D/dalvikvm(640): GC_BEFORE_OOM freed 13K, 3% free 8236K/8455K, paused 184ms, total 185ms
03-09 10:08:26.838: E/dalvikvm-heap(640): Out of memory on a 31961104-byte allocation.
03-09 10:08:26.838: I/dalvikvm(640): "main" prio=5 tid=1 RUNNABLE
03-09 10:08:26.848: I/dalvikvm(640): | group="main" sCount=0 dsCount=0 obj=0x40a14568 self=0x2a00b9e0
03-09 10:08:26.848: I/dalvikvm(640): | sysTid=640 nice=0 sched=0/0 cgrp=apps handle=1073870640
03-09 10:08:26.848: I/dalvikvm(640): | schedstat=( 1310216641 1726854966 299 ) utm=92 stm=39 core=0
03-09 10:08:26.858: I/dalvikvm(640): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-09 10:08:26.858: I/dalvikvm(640): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-09 10:08:26.858: I/dalvikvm(640): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-09 10:08:26.873: I/dalvikvm(640): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
03-09 10:08:26.878: I/dalvikvm(640): at android.content.res.Resources.loadDrawable(Resources.java:1930)
03-09 10:08:26.878: I/dalvikvm(640): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-09 10:08:26.878: I/dalvikvm(640): at android.widget.ImageView.<init>(ImageView.java:120)
03-09 10:08:26.878: I/dalvikvm(640): at android.widget.ImageView.<init>(ImageView.java:110)
03-09 10:08:26.878: I/dalvikvm(640): at java.lang.reflect.Constructor.constructNative(Native Method)
03-09 10:08:26.878: I/dalvikvm(640): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-09 10:08:26.878: I/dalvikvm(640): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-09 10:08:26.888: I/dalvikvm(640): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-09 10:08:26.888: I/dalvikvm(640): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-09 10:08:26.888: I/dalvikvm(640): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-09 10:08:26.888: I/dalvikvm(640): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-09 10:08:26.888: I/dalvikvm(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 10:08:26.888: I/dalvikvm(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 10:08:26.898: I/dalvikvm(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 10:08:26.898: I/dalvikvm(640): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-09 10:08:26.898: I/dalvikvm(640): at android.app.Activity.setContentView(Activity.java:1867)
03-09 10:08:26.898: I/dalvikvm(640): at edu.ajh161.designs.Ornaments.onCreate(Ornaments.java:13)
03-09 10:08:26.898: I/dalvikvm(640): at android.app.Activity.performCreate(Activity.java:5008)
03-09 10:08:26.910: I/dalvikvm(640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-09 10:08:26.910: I/dalvikvm(640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-09 10:08:26.910: I/dalvikvm(640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-09 10:08:26.910: I/dalvikvm(640): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-09 10:08:26.910: I/dalvikvm(640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-09 10:08:26.910: I/dalvikvm(640): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:08:26.910: I/dalvikvm(640): at android.os.Looper.loop(Looper.java:137)
03-09 10:08:26.918: I/dalvikvm(640): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-09 10:08:26.918: I/dalvikvm(640): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:08:26.918: I/dalvikvm(640): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 10:08:26.918: I/dalvikvm(640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-09 10:08:26.918: I/dalvikvm(640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-09 10:08:26.918: I/dalvikvm(640): at dalvik.system.NativeStart.main(Native Method)
03-09 10:08:26.928: D/skia(640): --- decoder->decode returned false
03-09 10:08:26.948: D/AndroidRuntime(640): Shutting down VM
03-09 10:08:26.958: W/dalvikvm(640): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-09 10:08:27.138: E/AndroidRuntime(640): FATAL EXCEPTION: main
03-09 10:08:27.138: E/AndroidRuntime(640): java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.ajh161.designs/edu.ajh161.designs.Ornaments}: android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.os.Looper.loop(Looper.java:137)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-09 10:08:27.138: E/AndroidRuntime(640): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 10:08:27.138: E/AndroidRuntime(640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-09 10:08:27.138: E/AndroidRuntime(640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-09 10:08:27.138: E/AndroidRuntime(640): at dalvik.system.NativeStart.main(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-09 10:08:27.138: E/AndroidRuntime(640): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 10:08:27.138: E/AndroidRuntime(640): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.Activity.setContentView(Activity.java:1867)
03-09 10:08:27.138: E/AndroidRuntime(640): at edu.ajh161.designs.Ornaments.onCreate(Ornaments.java:13)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.Activity.performCreate(Activity.java:5008)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-09 10:08:27.138: E/AndroidRuntime(640): ... 11 more
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: java.lang.reflect.InvocationTargetException
03-09 10:08:27.138: E/AndroidRuntime(640): at java.lang.reflect.Constructor.constructNative(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-09 10:08:27.138: E/AndroidRuntime(640): ... 24 more
03-09 10:08:27.138: E/AndroidRuntime(640): Caused by: java.lang.OutOfMemoryError
03-09 10:08:27.138: E/AndroidRuntime(640): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.content.res.Resources.loadDrawable(Resources.java:1930)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.widget.ImageView.<init>(ImageView.java:120)
03-09 10:08:27.138: E/AndroidRuntime(640): at android.widget.ImageView.<init>(ImageView.java:110)
03-09 10:08:27.138: E/AndroidRuntime(640): ... 27 more
03-09 10:08:31.238: I/Process(640): Sending signal. PID: 640 SIG: 9
Here, you are getting 3 Exceptions:
android.view.InflateException
java.lang.reflect.InvocationTargetException
java.lang.OutOfMemoryError
The problem starts to occurring from OutOfMemoryError Exception. The drawable, you are trying to set in the ImageView with the id imageview2, may be too large. So, when system trying to process that drawable it exceeds memory limit...then OutOfMemoryError Exception occurring.
Since, due to the OutOfMemoryError, system can't set that drawable to tha ImageView then its throwing other Exceptions as InvocationTargetException and InflateException.
Now, try to reduce the drawable's size...may be your problem will be solved.

Zbar : startPreview failed in galaxy S3

I have used ZBAR library to scan bar code in my Application.
And I got this error log while opening camera on Samsung Galaxy S3 :
java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.SGID.MainApp.ScanningFragment.engageCamera(ScanningFragment.java:184)
at com.SGID.MainApp.ScanningFragment.access$10(ScanningFragment.java:154)
at com.SGID.MainApp.ScanningFragment$4.run(ScanningFragment.java:111)
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:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.SGID.MainApp/com.SGID.MainApp.AllTabsActivity}
: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.SGID.MainApp.ParametersFragment.onCreateView(ParametersFragment.java:78)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
at android.app.Activity.performStart(Activity.java:5216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
... 11 more
EDIT :
Getting error at this line :
CameraPreview mPreview = new CameraPreview(getActivity(), mCamera, previewCb,
autoFocusCB);
Can Anyone help me to resolve this error??
Thanks in advance..

Selecting an item in ListFragment list programmatically

I've made my Android app tablet optimized and I followed the tutorial here:
Everything is great, but I am trying to select an item (say, the 1st item) with a button in the ActionBar.
I tried this answer to use performItemClick but on I've got error reports of java.lang.IllegalStateException
in android.support.v4.app.ListFragment.ensureList, java.lang.IllegalStateException: Content view not yet created, and java.lang.NullPointerException
in android.content.ComponentName.<init>
I've tried checking if the ListView is null and still get the error reports on the Play Store. How do I properly select an item in my list programmatically?
Update to add logcat and the code is virtually identical to the tutorials in the links:
Logcat A:
java.lang.IllegalStateException: Content view not yet created
at android.support.v4.app.ListFragment.ensureList(ListFragment.java:328)
at android.support.v4.app.ListFragment.getListView(ListFragment.java:222)
at com.ccwilcox.meteorshower.MeteorList.showMeteorDetails(MeteorList.java:69)
at com.ccwilcox.meteorshower.MeteorList.onListItemClick(MeteorList.java:62)
at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58)
at android.widget.AdapterView.performItemClick(AdapterView.java:298)
at android.widget.AbsListView.performItemClick(AbsListView.java:1280)
at com.ccwilcox.meteorshower.MainActivity.viewUpcomingEvent(MainActivity.java:648)
at com.ccwilcox.meteorshower.MainActivity.onOptionsItemSelected(MainActivity.java:534)
at android.app.Activity.onMenuItemSelected(Activity.java:2606)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1045)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:592)
at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:149)
at android.view.View.performClick(View.java:4222)
at android.view.View$PerformClick.run(View.java:17273)
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:4895)
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:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
Logcat B:
java.lang.NullPointerException
at android.content.ComponentName.<init>(ComponentName.java:75)
at android.content.Intent.<init>(Intent.java:2874)
at com.ccwilcox.meteorshower.MeteorList.showMeteorDetails(MeteorList.java:86)
at com.ccwilcox.meteorshower.MeteorList.onListItemClick(MeteorList.java:62)
at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.ListView.performItemClick(ListView.java:3701)
at com.ccwilcox.meteorshower.MainActivity.viewUpcomingEvent(MainActivity.java:648)
at com.ccwilcox.meteorshower.MainActivity.onOptionsItemSelected(MainActivity.java:534)
at android.app.Activity.onMenuItemSelected(Activity.java:2205)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:779)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:861)
at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
at android.view.View$PerformClick.run(View.java:9152)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Update 2
And here is the code that is causing the problem:
if (mListFragment.listView != null) {
mListFragment.listView.performItemClick(mListFragment.listView.getAdapter().getView(position, null, null), position, mListFragment.listView.getAdapter().getItemId(position));
}

Trying to get maps v2 Android demo working

New to Android etc.
So I was recommended this demo:
http://dj-android.blogspot.in/2013/02/android-google-map-v2-part-1.html
I followed it, but something must have gone wrong.
...
In workspace I have my own project:
Inside this project: In "Libs" I have added "android-support-v4.jar"
Inside this project: In Android Depencides I have "android-support-v4.jar"
Inside this project: In References Libraries I have "google-play-services.jar"
Inside this project: In References Libraries I have "android-support-v4.jar"
...
In workspace I have google-play-services_lib as a project:
Inside this project: In "Libs" I have "google-play-services.jar"
Inside this project: In "Libs" I have "google-play-services.jar.properties"
Inside this project: In "Android Dependencies" I have "google-play-services.jar"
...
When I run above project on SGII v4.1.2 I get black screen followed by crasj followed by error:
03-09 00:28:49.957: E/AndroidRuntime(20309): FATAL EXCEPTION: main
03-09 00:28:49.957: E/AndroidRuntime(20309): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapstest/com.example.mapstest.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread.access$700(ActivityThread.java:140)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.os.Looper.loop(Looper.java:137)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread.main(ActivityThread.java:4921)
03-09 00:28:49.957: E/AndroidRuntime(20309): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 00:28:49.957: E/AndroidRuntime(20309): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 00:28:49.957: E/AndroidRuntime(20309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
03-09 00:28:49.957: E/AndroidRuntime(20309): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
03-09 00:28:49.957: E/AndroidRuntime(20309): at dalvik.system.NativeStart.main(Native Method)
03-09 00:28:49.957: E/AndroidRuntime(20309): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 00:28:49.957: E/AndroidRuntime(20309): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.Activity.setContentView(Activity.java:1924)
03-09 00:28:49.957: E/AndroidRuntime(20309): at com.microsystools.mapstest.MainActivity.onCreate(MainActivity.java:17)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.Activity.performCreate(Activity.java:5206)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
03-09 00:28:49.957: E/AndroidRuntime(20309): ... 11 more
03-09 00:28:49.957: E/AndroidRuntime(20309): Caused by: android.support.v4.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
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
03-09 00:28:49.957: E/AndroidRuntime(20309): ... 21 more
03-09 00:28:49.957: E/AndroidRuntime(20309): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment
03-09 00:28:49.957: E/AndroidRuntime(20309): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-09 00:28:49.957: E/AndroidRuntime(20309): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-09 00:28:49.957: E/AndroidRuntime(20309): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-09 00:28:49.957: E/AndroidRuntime(20309): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
03-09 00:28:49.957: E/AndroidRuntime(20309): ... 24 more
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=".MainActivity" >
<fragment
android:id="#+id/fragment1"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
MainActivity.Java
package com.example.mapstest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.activity_main);
}
}
NOTE 1:
Do you guys belive it can be a problem related to the API key somehow? I use this as API key:
HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH;com.exampledomain.exampleproject
Notice the ending. Is that correct?
I had to edit the output from keytool, so not 100% sure the API key is good. See:
Maps v2 API Key on Android
NOTE 2:
Some screenshots of my current configuration:
If you believe the cause of my problems is that Google Play Services is not installed correctly, I have created a separate SO for that at: Can not install google-play-services into Eclipse correctly (trying to get maps working)
Try this one:
link
it's a blog post i wrote on creating a Google Map API V2.
UPDATE:
I took a picture from my working map project. ignore the crash reporting services libs like acra, flurry, bugsense and crittercism. other then those you project looks the same?
do you have google-play-services_lib.jar in your Android Dependencies folder?
In References Libraries I have added "google-play-services.jar"
That is incorrect. Please remove that. Then, import the Play Services Android library project to your Eclipse environment, and attach it to your project.
Quoting the documentation:
Copy the /extras/google/google_play_services/libproject/google-play-services_lib library project into the source tree where you maintain your Android app projects.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
To set up a project to use the Google Play services SDK... Reference the library project in your Android project. See the Referencing a Library Project for Eclipse or Referencing a Library Project on the Command Line for more information on how to do this.

Android mediaplayback service binding causes SecurityException?

While binding the MediaPlaybackService in android 4.0.3 throws an exception as follows :
03-09 09:51:08.399: ERROR/AndroidRuntime(664): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sudarmuthu.android.adjustvolume/com.sudarmuthu.android.adjustvolume.AdjustVolume}: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=com.android.music/.MediaPlaybackService }
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread.access$600(ActivityThread.java:123)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.os.Looper.loop(Looper.java:137)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread.main(ActivityThread.java:4424)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at dalvik.system.NativeStart.main(Native Method)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=com.android.music/.MediaPlaybackService }
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ContextImpl.bindService(ContextImpl.java:1135)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at com.sudarmuthu.android.adjustvolume.AdjustVolume.onStart(AdjustVolume.java:153)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.Activity.performStart(Activity.java:4475)
03-09 09:51:08.399: ERROR/AndroidRuntime(664): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
This application is smoothly running in android 2.1 versions.
Any Help!!
Please refer this link http://groups.google.com/group/android-developers/browse_thread/thread/a03ea845989a49ba , I think this will help you...

Categories

Resources