What sort of xml is the SimpleCursorAdapter expecting? - android

I've been having problems with displaying Contacts in an AlertDialog, and I think I've found the
problem, but am still confused. The pertinent suspect part of my code is:
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, mContacts,
new String[] { ContactsContract.Contacts.DISPLAY_NAME },
new int[] { android.R.id.text1 });
...Now "simple_list_item_1" is accepted by the compiler (the app runs in the Emulator), however when
I try to run this ListActivity, it bombs.
So after reading elsewhere about how to accomplish this task my eyes lit upon the aforepasted
"simple_list_item_1" - where is that? I didn't create any simple_list_item_1.xml file, and it doesn't exist in my \res\layout folder. So I (in Eclipse) right-clicked "simple_list_item_1" and selected "Open Declaration" and it invoked an err msg much or exactly like the one I see in the Debug Perspective about "Class File Editor | Source nout found | The JAR file ....\android.jar has no source attachment."
So...assuming this is the problem (there is no "simple_list_item_1.xml" in my \res\layout folder), what exactly is expected in this file (which I assume is simply a xml definition of what I want each Contact to display in)?
==============
Here is some LogCat data:
Here are the last lines in LogCat (it seems to die/hang once it gets to the ListActivity (ContactsActivity):
com.aXX3AndSpace.KeepInTouch/.KeepInTouchActivity: +5s368ms
01-08 21:54:34.020: I/ActivityManager(61): Starting: Intent { cmp=com.aXX3AndSpace.KeepInTouch/.ContactsActivity } from pid 385
...and here are all of the Error msgs in one attempted run (open the app, try to invoke the ListActivity). Note the "THIS SHOULD NEVER occur" msg at the end:
01-08 21:53:36.592: E/Zygote(33): setreuid() failed. errno: 2
01-08 21:53:46.423: E/Zygote(33): setreuid() failed. errno: 17
01-08 21:53:47.842: E/BatteryService(61): usbOnlinePath not found
01-08 21:53:47.842: E/BatteryService(61): batteryVoltagePath not found
01-08 21:53:47.842: E/BatteryService(61): batteryTemperaturePath not found
01-08 21:53:47.862: E/SurfaceFlinger(61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
01-08 21:53:48.082: E/SensorService(61): couldn't open device for module sensors (Invalid argument)
01-08 21:53:53.722: E/System(61): Failure starting core service
01-08 21:53:53.722: E/System(61): java.lang.SecurityException
01-08 21:53:53.722: E/System(61): at android.os.BinderProxy.transact(Native Method)
01-08 21:53:53.722: E/System(61): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
01-08 21:53:53.722: E/System(61): at android.os.ServiceManager.addService(ServiceManager.java:72)
01-08 21:53:53.722: E/System(61): at com.android.server.ServerThread.run(SystemServer.java:207)
01-08 21:53:53.742: E/EventHub(61): could not get driver version for /dev/input/mouse0, Not a typewriter
01-08 21:53:53.742: E/EventHub(61): could not get driver version for /dev/input/mice, Not a typewriter
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/Effect_Tick.ogg
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/KeypressStandard.ogg
01-08 21:53:54.032: E/SoundPool(61): error loading /system/media/audio/ui/KeypressSpacebar.ogg
01-08 21:53:54.042: E/SoundPool(61): error loading /system/media/audio/ui/KeypressDelete.ogg
01-08 21:53:54.042: E/SoundPool(61): error loading /system/media/audio/ui/KeypressReturn.ogg
01-08 21:53:54.703: E/ThrottleService(61): Could not open GPS configuration file /etc/gps.conf
01-08 21:53:57.172: E/logwrapper(158): executing /system/bin/tc failed: No such file or directory
01-08 21:53:57.242: E/logwrapper(159): executing /system/bin/tc failed: No such file or directory
01-08 21:53:57.282: E/logwrapper(160): executing /system/bin/tc failed: No such file or directory
01-08 21:54:00.074: E/jdwp(174): Failed sending reply to debugger: Broken pipe
01-08 21:54:00.712: E/Database(116): sqlite_config failed error_code = 21. THIS SHOULD NEVER occur.

simple_list_item_1 is a standard layout defined in the SDK, it's basically just a TextView with the id "android:id/text1", which is what you supply in your view identifiers.
Do you have the stacktrace of the crash? Because it's most likely not due to a missing simple_list_item_1 layout.

Create a new XML layout file using Eclipse wizard. The name of this file will replace simple_list_item_1 in your code:
In this layout, create a TextView (or any other container) element and call it text1:
Then SimpleCursorAdaptor will match your contact info and the text1 field in your layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />

Related

Issue libperfservice hotplug/cmd couldn't be open

I'm new on eclipse and android and I want for my first app do a wifi connection between the smartphone and an ip camera, unfortunately my app crash if when I want to see the stream of the camera.
My logcat said that:
03-06 18:11:26.879: E/(680): Could not open '/data/data/hotplug/cmd'<br/>
03-06 18:11:26.879: E/(680): error : 2, No such file or directory
[Edit k3b 2017-08-09]
I have the same issue on my andriod-4.4 my logcat contain this
08-09 20:38:40.436 1883-2035/? I/libPerfService: 1: set: 1
[ 08-09 20:38:40.436 1883:0x7f3 E/ ]
Could not open '/data/data/hotplug/cmd'
[ 08-09 20:38:40.436 1883:0x7f3 E/ ]
error : 2, No such file or directory
googleing "libPerfService" for found androidStudio log doesn't work
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set freq: 1950000
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set: 4
found https://census.tsyrklevich.net/file_permissions//system/lib/libperfservice.so with no description
Does anybody know where libPerfService comes from? is this a maleware waiting for command? I have not found any defintion for it.

Android Hello World app crashes: IllegalArgumentException from Surface.lockCanvasNative

I am trying to run the simplest Hello World example app and looks like I can crash it even all it does is showing a TextView.
Steps to reproduce: Launch it in the emulator (1.5). Open the app - it shows the text view, then lock the phone by pressing "end call" button. Unlock by pressing "menu", then press "back". App crashes with "The process android.process.acore has stopped unexpectedly..." and Force Close button. It does not happen all the time, but I am able to reproduce it every time after wiping the user data at least.
I wonder if default Hello World is missing a detail which was considered too advanced for a hello world... Such problems with a basic example does not look very encouraging =)
Any idea what detail is missing and how to avoid this crash?
Stack (I've truncated timestamps):
37.478: DEBUG/KeyguardViewMediator(576): wakeWhenReadyLocked(82)
37.481: DEBUG/KeyguardViewMediator(576): handleWakeWhenReady(82)
37.481: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.110: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.140: WARN/InputManagerService(576): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#436e3fc0
40.990: ERROR/IMemory(679): binder=0x238aa8 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
40.990: ERROR/IMemory(679): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
40.990: ERROR/IMemory(679): cannot map BpMemoryHeap (binder=0x238aa8), size=0, fd=-1 (Bad file number)
40.990: ERROR/Surface(679): Couldn't map Surface's heap (binder=0x238aa8, heap=0x238b00)
40.990: DEBUG/AndroidRuntime(679): Shutting down VM
40.990: WARN/dalvikvm(679): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
40.990: ERROR/AndroidRuntime(679): Uncaught handler: thread main exiting due to uncaught exception
40.990: ERROR/AndroidRuntime(679): java.lang.IllegalArgumentException
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvasNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvas(Surface.java:196)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.draw(ViewRoot.java:1175)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
40.990: ERROR/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99)
40.990: ERROR/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:123)
40.990: ERROR/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:3948)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:521)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
40.990: ERROR/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)
41.000: INFO/Process(576): Sending signal. PID: 679 SIG: 3
41.000: INFO/dalvikvm(679): threadid=7: reacting to signal 3
41.030: ERROR/ActivityThread(576): Failed to find provider info for android.server.checkin
41.030: ERROR/Checkin(576): Error reporting crash: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/crashes
41.070: INFO/dalvikvm(679): Wrote stack trace to '/data/anr/traces.txt'
50.940: WARN/ActivityManager(576): Launch timeout has expired, giving up wake lock!
50.980: WARN/ActivityManager(576): Activity idle timeout for HistoryRecord{4366ac40 {com.android.launcher/com.android.launcher.Launcher}}
sounds to me more like something wrong with your emulator. Why dont you delete your emulator and create a new one and try again with a fresh project.
Hope that will help you. BTW why are you using emulator on 1.5?? Start to build applications for min 2.1.
Good luck.

Logcat errors when running android emulator

I'm running an emulator targeting 2.3 (API Level 9). I've removed all downloaded apps (which includes any code that I've written) but I still get all of these logcat errors when I start up the emulator:
[ollie#devdataload scripts]$ startlogcat.sh
- waiting for device -
E/Zygote ( 32): setreuid() failed. errno: 2
E/Zygote ( 32): setreuid() failed. errno: 17
E/BatteryService( 61): usbOnlinePath not found
E/BatteryService( 61): batteryVoltagePath not found
E/BatteryService( 61): batteryTemperaturePath not found
E/SurfaceFlinger( 61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
E/SensorService( 61): couldn't open device for module sensors (Invalid argument)
E/System ( 61): Failure starting core service
E/System ( 61): java.lang.SecurityException
E/System ( 61): at android.os.BinderProxy.transact(Native Method)
E/System ( 61): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
E/System ( 61): at android.os.ServiceManager.addService(ServiceManager.java:72)
E/System ( 61): at com.android.server.ServerThread.run(SystemServer.java:206)
E/EventHub( 61): could not get driver version for /dev/input/mouse0, Not a typewriter
E/EventHub( 61): could not get driver version for /dev/input/mice, Not a typewriter
E/SoundPool( 61): error loading /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 61): error loading /system/media/audio/ui/KeypressStandard.ogg
E/SoundPool( 61): error loading /system/media/audio/ui/KeypressSpacebar.ogg
E/SoundPool( 61): error loading /system/media/audio/ui/KeypressDelete.ogg
E/SoundPool( 61): error loading /system/media/audio/ui/KeypressReturn.ogg
E/UsbObserver( 61):
E/UsbObserver( 61): java.lang.NullPointerException
E/UsbObserver( 61): at com.android.server.UsbObserver.init(UsbObserver.java:131)
E/UsbObserver( 61): at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
E/UsbObserver( 61): at com.android.server.ServerThread.run(SystemServer.java:402)
E/ThrottleService( 61): Could not open GPS configuration file /etc/gps.conf
E/logwrapper( 125): executing /system/bin/tc failed: No such file or directory
E/logwrapper( 126): executing /system/bin/tc failed: No such file or directory
E/logwrapper( 127): executing /system/bin/tc failed: No such file or directory
I'd like to try to clean these up so that I can know for sure that any errors I'm looking at are being caused by my code. Does anyone else get these error messages and do you fix them or just ignore them?
If they don't deal with your application, you can ignore them. There is nothing you can do as a developer to fix a manufacturer problem on other peoples phones or even yours for that matter (well short of a custom rom).
Edit: I'd also add that some errors/warnings are normal and are not to be of concern.
Common logging practice in Android is smth like:
public class MyClass
{
public static final String TAG=MyClass.class.getName();
// some stuff
Log.i(TAG, "My log message");
}
So when you're inspecting LogCat messages you can filter your logs using those TAG. This is way to ignore other logs.

Error message during the AVD starting process

I've created an AVD (version 2.2) using preferences set as default.
However everytime I start it I got error messages list below:
12-26 16:19:07.566: ERROR/Zygote(33): setreuid() failed. errno: 2
12-26 16:19:15.707: ERROR/Zygote(33): setreuid() failed. errno: 17
12-26 16:19:17.635: ERROR/BatteryService(87): usbOnlinePath not found
12-26 16:19:17.635: ERROR/BatteryService(87): batteryVoltagePath not found
12-26 16:19:17.645: ERROR/BatteryService(87): batteryTemperaturePath not found
12-26 16:19:17.695: ERROR/SurfaceFlinger(87): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
12-26 16:19:48.305: ERROR/EventHub(87): could not get driver version for /dev/input/mouse0, Not a typewriter
12-26 16:19:48.305: ERROR/EventHub(87): could not get driver version for /dev/input/mice, Not a typewriter
12-26 16:19:48.495: ERROR/System(87): Failure starting core service
12-26 16:19:48.495: ERROR/System(87): java.lang.SecurityException
12-26 16:19:48.495: ERROR/System(87): at android.os.BinderProxy.transact(Native Method)
12-26 16:19:48.495: ERROR/System(87): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
12-26 16:19:48.495: ERROR/System(87): at android.os.ServiceManager.addService(ServiceManager.java:72)
12-26 16:19:48.495: ERROR/System(87): at com.android.server.ServerThread.run(SystemServer.java:184)
12-26 16:19:49.675: ERROR/SoundPool(87): error loading /system/media/audio/ui/Effect_Tick.ogg
12-26 16:19:49.685: ERROR/SoundPool(87): error loading /system/media/audio/ui/KeypressStandard.ogg
12-26 16:19:49.705: ERROR/SoundPool(87): error loading /system/media/audio/ui/KeypressSpacebar.ogg
12-26 16:19:49.716: ERROR/SoundPool(87): error loading /system/media/audio/ui/KeypressDelete.ogg
12-26 16:19:49.725: ERROR/SoundPool(87): error loading /system/media/audio/ui/KeypressReturn.ogg
12-26 16:19:54.736: ERROR/ThrottleService(87): Could not open GPS configuration file /etc/gps.conf
12-26 16:19:54.836: ERROR/ThrottleService(87): Error reading data file
12-26 16:19:55.816: ERROR/logwrapper(186): executing /system/bin/tc failed: No such file or directory
12-26 16:19:55.916: ERROR/logwrapper(188): executing /system/bin/tc failed: No such file or directory
12-26 16:19:55.995: ERROR/logwrapper(190): executing /system/bin/tc failed: No such file or directory
12-26 16:20:02.135: ERROR/logwrapper(202): executing /system/bin/tc failed: No such file or directory
12-26 16:20:02.245: ERROR/logwrapper(203): executing /system/bin/tc failed: No such file or directory
12-26 16:20:02.295: ERROR/logwrapper(204): executing /system/bin/tc failed: No such file or directory
12-27 00:20:16.924: ERROR/HierarchicalStateMachine(87): TetherMaster - unhandledMessage: msg.what=3
12-27 00:20:17.174: ERROR/HierarchicalStateMachine(87): TetherMaster - unhandledMessage: msg.what=3
12-27 00:20:21.224: ERROR/HierarchicalStateMachine(87): TetherMaster - unhandledMessage: msg.what=3
12-27 00:20:47.534: ERROR/MetadataRetrieverClient(34): failed to extract an album art
12-27 00:21:24.814: ERROR/ThrottleService(87): Error reading data file
Please let me know how can I fix these errors. Thanks a lot!
Unless you are experiencing actual problems, you can ignore error messages that occur during the startup of your emulator.

What do these LogCat errors mean? My program crashes

07-03 23:59:01.067: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
07-03 23:59:01.067: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory)
07-03 23:59:01.067: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
07-03 23:59:01.067: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory)
07-03 23:59:28.297: ERROR/BatteryService(60): usbOnlinePath not found
07-03 23:59:28.307: ERROR/BatteryService(60): batteryVoltagePath not found
07-03 23:59:28.307: ERROR/BatteryService(60): batteryTemperaturePath not found
07-03 23:59:28.407: ERROR/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
07-03 23:59:39.097: ERROR/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter
07-03 23:59:39.137: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter
07-03 23:59:39.777: ERROR/System(60): Failure starting core service
07-03 23:59:39.777: ERROR/System(60): java.lang.SecurityException
07-03 23:59:39.777: ERROR/System(60): at android.os.BinderProxy.transact(Native Method)
07-03 23:59:39.777: ERROR/System(60): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
07-03 23:59:39.777: ERROR/System(60): at android.os.ServiceManager.addService(ServiceManager.java:72)
07-03 23:59:39.777: ERROR/System(60): at com.android.server.ServerThread.run(SystemServer.java:176)
07-03 23:59:39.837: ERROR/AndroidRuntime(60): Crash logging skipped, no checkin service
07-04 00:00:00.400: ERROR/vold(26): Cannot start volume '/sdcard' (volume is not bound)
07-04 00:00:01.147: ERROR/MediaPlayerService(30): Couldn't open fd for content://settings/system/notification_sound
07-04 00:00:01.227: ERROR/MediaPlayer(60): Unable to to create media player
07-04 00:00:06.315: ERROR/ActivityThread(104): Failed to find provider info for android.server.checkin
07-04 00:00:11.615: ERROR/ActivityThread(104): Failed to find provider info for android.server.checkin
07-04 00:00:12.124: ERROR/ActivityThread(104): Failed to find provider info for android.server.checkin
07-04 00:00:35.335: ERROR/AndroidRuntime(126): ERROR: thread attach failed
07-04 00:00:42.835: ERROR/AndroidRuntime(211): ERROR: thread attach failed
I'm assuming that you're working on Android, and that you're also referring to the exception in the middle of the log.
The SecurityException means you probably forgot to give the application the necessary permissions - you should change the Manifest XML file, as explained here.

Categories

Resources