I reference and imitates the Android Sample at android-sdks\samples\android-18\legacy\BluetoothLeGatt to developing an application.
I can scan the device.
But the app crash when I try to connect the bluetooth device.
This is the log that the app crash when I try to connect the bluetooth device.
D/BtGatt.btif( 2443): btif_gattc_scan
D/BtGatt.btif( 2443): btgattc_handle_event: Event 1003
D/BtGatt.GattService( 2443): unregisterClient() - clientIf=4
D/BtGatt.btif( 2443): btif_gattc_unregister_app
D/BtGatt.btif( 2443): btgattc_handle_event: Event 1001
D/BtGatt.btif( 2443): btif_gattc_upstreams_evt: Event 1
I/ActivityManager( 1766): START u0 {cmp=com.example.prevent_the_lost/.DeviceControl (has extras)} from pid 5526
W/WindowManager( 1766): Screenshot failure taking screenshot for (166x125) to layer 21015
I/bt-hci ( 2443): BLE HCI(id=62) event = 0x02)
I/bt-hci ( 2443): btu_ble_process_adv_pkt
D/BluetoothAdapter( 5526): stopLeScan()
I/bt-hci ( 2443): BLE HCI(id=62) event = 0x02)
I/bt-hci ( 2443): btu_ble_process_adv_pkt
D/dalvikvm( 5526): GC_CONCURRENT freed 165K, 5% free 4427K/4624K, paused 1ms+1ms, total 5ms
W/ActivityManager( 1766): Unable to start service Intent { cmp=com.example.prevent_the_lost/.BluetoothLeService } U=0: not found
I/ActivityManager( 1766): Displayed com.example.prevent_the_lost/.DeviceControl: +29ms
D/AndroidRuntime( 5526): Shutting down VM
W/dalvikvm( 5526): threadid=1: thread exiting with uncaught exception (group=0x94ee8648)
E/AndroidRuntime( 5526): FATAL EXCEPTION: main
E/AndroidRuntime( 5526): java.lang.NullPointerException
E/AndroidRuntime( 5526): at com.example.prevent_the_lost.DeviceControl.onOptionsItemSelected(DeviceControl.java:140)
E/AndroidRuntime( 5526): at android.app.Activity.onMenuItemSelected(Activity.java:2566)
E/AndroidRuntime( 5526): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:986)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime( 5526): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime( 5526): at android.view.View.performClick(View.java:4240)
E/AndroidRuntime( 5526): at android.view.View$PerformClick.run(View.java:17721)
E/AndroidRuntime( 5526): at android.os.Handler.handleCallback(Handler.java:730)
E/AndroidRuntime( 5526): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 5526): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 5526): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime( 5526): at java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 5526): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 5526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime( 5526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 5526): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1766): Force finishing activity com.example.prevent_the_lost/.DeviceControl
W/WindowManager( 1766): Screenshot failure taking screenshot for (166x125) to layer 21020
W/ActivityManager( 1766): Activity pause timeout for ActivityRecord{4aad960c u0com.example.prevent_the_lost/.DeviceControl}
I/Process ( 5526): Sending signal. PID: 5526 SIG: 9
W/InputDispatcher( 1766): channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 1766): channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 1766): channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)' ~ Consumer closed input channel or an error occurred. events=0xd
E/InputDispatcher( 1766): channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)' ~ Channel is unrecoverably brokenand will be disposed!
W/InputDispatcher( 1766): Attempted to unregister already unregistered input channel '4aaa49ec com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List (server)'
W/InputDispatcher( 1766): Attempted to unregister already unregistered input channel '4aa9c3e4 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl (server)'
I/ActivityManager( 1766): Process com.example.prevent_the_lost (pid 5526) has died.
I/WindowState( 1766): WIN DEATH: Window{4aaa49ec u0 com.example.prevent_the_lost/com.example.prevent_the_lost.Device_List}
I/WindowState( 1766): WIN DEATH: Window{4aa9c3e4 u0 com.example.prevent_the_lost/com.example.prevent_the_lost.DeviceControl}
I/ActivityManager( 1766): Start proc com.example.prevent_the_lost for activity com.example.prevent_the_lost/.Device_List: pid=5545 uid=10043 gids={50043, 3001,3002, 1028}
I/ActivityThread( 5545): Switching default density from 160 to 130
D/BluetoothManagerService( 1766): Message: 20
D/BluetoothManagerService( 1766): Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy#4ab1fee8:true
W/InputMethodManagerService( 1766): Got RemoteException sending setActive(false) notification to pid 5526 uid 10043
I/ActivityManager( 1766): Displayed com.example.prevent_the_lost/.Device_List: +171ms
D/dalvikvm( 1766): GC_CONCURRENT freed 455K, 19% free 7301K/8980K, paused 1ms+1ms, total 12ms
I don't know what the error in this Log ??
Could somebody tell me the error and how to solve it ???
Thanks a lot!!!
I find the error is "Unable to start service Intent"
The solution is add the Service in Manifest -> Application.
Related
I've been trying to turn on an Accessibility Service using Android's. I run an emulator using Android Studio (Nexus S API 19, armabi-v7). I'm able to open the accessibility settings when the emulator is running. (By clicking on the circled submenu)
Setting Screen with Accessibility Sub-Menu highlighted
Yet when I run try to attach monkeyrunner by opening an interactive monkeyrunner terminal and running:
>> from android.com.monkeyrunner import MonkeyRunner, MonkeyDevice
>> d = MonkeyRunner.waitForConnection()
I'm unable to get navigate to the accessibility settings screen and get the error message
Result of selecting accessibility sub-menu from settings when MonkeyDevice is attached
as soon as I detach the monkeyDevice, I'm able to get to the accessibility settings screen again. Any idea what could cause it?
snippet from the logs when there's an error:
##Logs from Failure ## I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519 ... I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 751
...
D/SubSettings( 751): Launching fragment com.android.settings.accessibility.AccessibilitySettings ... E/AndroidRuntime( 751): FATAL EXCEPTION: main
E/AndroidRuntime( 751): Process: com.android.settings, PID: 751
E/AndroidRuntime( 751): java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2774)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)
E/AndroidRuntime( 751): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 751): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 751): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 751): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 751): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 751): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 751): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.loadInstalledServices(AccessibilitySettings.java:641)
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.onResume(AccessibilitySettings.java:214)
E/AndroidRuntime( 751): at android.app.Fragment.performResume(Fragment.java:1743)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
E/AndroidRuntime( 751): at android.app.Activity.performResume(Activity.java:5320)
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)
E/AndroidRuntime( 751): ... 12 more
W/ActivityManager( 357): Force finishing activity com.android.settings/.SubSettings
W/ActivityManager( 357): Force finishing activity com.android.settings/.Settings ... W/ActivityManager( 357): Activity pause timeout for ActivityRecord{b3ea9e08 u0 com.android.settings/.SubSettings t2 f}
There seems to be a NullPointer exception, but I don't know what could cause that
##Log Snippet Without Failure I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519
I/ActivityManager( 357): Start proc com.android.settings for activity com.android.settings/.Settings: pid=1095 uid=1000 gids={41000, 1028, 1015, 3002, 3001, 3003}
D/dalvikvm( 59): GC_EXPLICIT freed 40K, 5% free 2777K/2900K, paused 15ms+3ms, total 96ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 3ms+14ms, total 67ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 7ms+14ms, total 76ms
D/dalvikvm( 1095): GC_FOR_ALLOC freed 118K, 7% free 2987K/3188K, paused 35ms, total 37ms
I/dalvikvm-heap( 1095): Grow heap (frag case) to 3.602MB for 635812-byte allocation
D/dalvikvm( 1095): GC_FOR_ALLOC freed 3K, 6% free 3605K/3812K, paused 44ms, total 44ms
D/dalvikvm( 1095): GC_CONCURRENT freed <1K, 6% free 3605K/3812K, paused 4ms+2ms, total 53ms
E/BluetoothAdapter( 1095): Bluetooth binder is null
D/dalvikvm( 1095): GC_CONCURRENT freed 209K, 8% free 3793K/4088K, paused 2ms+16ms, total 65ms
D/ ( 1095): HostConnection::get() New Host Connection established 0xb82ef4c0, tid 1095
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/OpenGLRenderer( 1095): Enabling debug mode 0
I/ActivityManager( 357): Displayed com.android.settings/.Settings:
+2s599ms
D/dalvikvm( 1095): GC_CONCURRENT freed 124K, 5% free 4057K/4268K, paused 15ms+5ms, total 101ms
I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 1095
D/SubSettings( 1095): Launching fragment com.android.settings.accessibility.AccessibilitySettings
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/dalvikvm( 1095): GC_CONCURRENT freed 223K, 7% free 4267K/4576K, paused 20ms+65ms, total 345ms
I/Choreographer( 1095): Skipped 120 frames! The application may be doing too much work on its main thread.
I/ActivityManager( 357): Displayed com.android.settings/.SubSettings:
+3s235ms
I am working on android application, My application is crashing saying this message
'Unfortunately process "iTextSharpGeneric.ITextSharp" has stopped' when i am navigating form other application to my application. iTextSharpGeneric is my projoect name.
i found this excpetion in Adnroid device logging window:-
"java.lang.RunttimeException: Unable to instantiate activity ComponentInfo{com.iTextSharpGenericTest/iTextSharpGenericTest..TestActivity2}.java.lang.ClassNotFoundException"
Here is the scenari i am doing. In my application
ITextSharpGeneric--> Opening a pdf(using adobe reader)-> After Editing pdf In Adobe reader-> Selecting Share option-> Showing list of application-> I am selecting "iTextSharpGeneric" n the list of applications(to save that edited pdf details)-> "Application Crashes here"
I tried using the save OnSaveInstanceState() and OnRestoreInstanceState() for retaining the acitivity state. But still getting the same issue.
Here is my intent filters tags in AndroidManifest.xml
activity android:name="com.iTextSharpGenericTest.Activity2" android:label="iTextSharp"
intent-filter
action android:name="android.intent.action.MAIN"
action android:name="android.intent.action.SEND"
action android:name="android.intent.action.VIEW"
category android:name="android.intent.category.DEFAULT"
category android:name="android.intent.category.BROWSABLE"
data android:mimeType="application/pdf"
intent-filter
activity
What's wrong i am doing? Let me know you valueble suggesstions.
Here is the detailed log of exception, I just selected filter option"Android Runtime" in Android Device Logging Window.
02-21 14:31:33.000 E/AndroidRuntime( 5614): FATAL EXCEPTION: main
02-21 14:31:33.000 E/AndroidRuntime( 5614): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}: java.lang.ClassNotFoundException: iTextSharpGenericTest.Activity2
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1884)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.os.Looper.loop(Looper.java:137)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.main(ActivityThread.java:4447)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.reflect.Method.invoke(Method.java:511)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at dalvik.system.NativeStart.main(Native Method)
02-21 14:31:33.000 E/AndroidRuntime( 5614): Caused by: java.lang.ClassNotFoundException: iTextSharpGenericTest.Activity2
02-21 14:31:33.000 E/AndroidRuntime( 5614): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
02-21 14:31:33.000 E/AndroidRuntime( 5614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1875)
02-21 14:31:33.000 E/AndroidRuntime( 5614): ... 11 more
02-21 14:31:33.010 W/ActivityManager( 169): Force finishing activity com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2
02-21 14:31:33.520 W/ActivityManager( 169): Activity pause timeout for ActivityRecord{4163ed28 com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}
02-21 14:31:33.650 D/OpenGLRenderer( 5215): Flushing caches (mode 0)
02-21 14:31:43.820 W/ActivityManager( 169): Activity destroy timeout for ActivityRecord{4163ed28 com.iTextSharpGenericTest/iTextSharpGenericTest.Activity2}
02-21 14:31:46.360 I/Process ( 5614): Sending signal. PID: 5614 SIG: 9
02-21 14:31:46.380 W/InputDispatcher( 169): channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)' ~ Consumer closed input channel or an error occurred. events=0x8
02-21 14:31:46.380 E/InputDispatcher( 169): channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)' ~ Channel is unrecoverably broken and will be disposed!
02-21 14:31:46.380 W/InputDispatcher( 169): Attempted to unregister already unregistered input channel '414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 (server)'
02-21 14:31:46.380 I/ActivityManager( 169): Process com.iTextSharpGenericTest (pid 5614) has died.
02-21 14:31:46.380 V/TabletStatusBar( 250): setLightsOn(true)
02-21 14:31:46.380 I/WindowManager( 169): WIN DEATH: Window{414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 paused=false}
02-21 14:31:46.390 I/WindowManager( 169): WINDOW DIED Window{414cb888 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1 paused=false}
02-21 14:31:46.630 D/AndroidRuntime( 5645):
02-21 14:31:46.630 D/AndroidRuntime( 5645): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-21 14:31:46.630 D/AndroidRuntime( 5645): CheckJNI is OFF
02-21 14:31:46.870 D/AndroidRuntime( 5645): Calling main entry com.android.commands.am.Am
02-21 14:31:46.880 D/AndroidRuntime( 5645): Shutting down VM
02-21 14:31:46.880 I/AndroidRuntime( 5645): NOTE: attach of thread 'Binder Thread #3' failed
02-21 14:31:46.880 I/ActivityManager( 169): Force stopping package com.iTextSharpGenericTest uid=10086
02-21 14:31:46.880 I/ActivityManager( 169): Force finishing activity ActivityRecord{41291510 com.iTextSharpGenericTest/itextsharpgenerictest.Activity1}
02-21 14:31:46.890 D/dalvikvm( 5645): GC_CONCURRENT freed 96K, 83% free 450K/2560K, paused 1ms+0ms
02-21 14:32:29.770 D/dalvikvm( 250): GC_CONCURRENT freed 422K, 73% free 8194K/30151K, paused 2ms
Thanks
Sreeni
"iTextSharpGenericTest..TestActivity2}"
As you can see, you are actually passing your Intentfilter for you class wrong. There are 2 dots between iTextSharpGenericTest and TestActivity2.
May be that's the case why it is not able to detect your TestActivity2 class and hence throwing that error java.lang.ClassNotFoundException.
Hope this helps.
I have a activity which uses a listview element as follows
public class List1 extends Activity
{
Context context=this;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
try{
//DB
final SQLiteDatabase db;
db = openOrCreateDatabase(
"Secret.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
Cursor cur = db.query("tbl_user",null,null,null,null,null,null);
//DB Over
ListView listView = (ListView) findViewById(R.id.mylist);
listView.setTextFilterEnabled(true);
final String[] values = new String[50];
int i=0;
while(cur.moveToNext())
{
values[i]=Integer.toString(cur.getInt(0))+":"+cur.getString(1)+":"+cur.getString(2);
i++;
}
cur.close();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,R.layout.list_item,values);
listView.setAdapter(adapter);
listView.setVisibility(0);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,long id)
//public void onItemClick(ListView<?> listview, View view, int position,long id)
{
try
{
Intent i=new Intent(List1.this,Form1.class);
i.putExtra("uid","85");
startActivity(i);
finish();
}
catch(Exception e)
{
String insert2="insert into login values("+"\""+e.toString()+"\""+");";
db.execSQL(insert2);
}
}
});
db.close();
//required
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();}
}
}
This is my listview.xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</RelativeLayout>
This is my list_item.xml file which has the required textview
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/tv1"
android:padding="10dp"
android:background="#drawable/textview1"
style="#style/textview_text"
android:textSize="16dp">
</TextView>
But the ListView is not working. I mean after coming to this activity the app is showing error showing "APP_NAME is stopped unexpectedly". The same code works for one or two times and then shows the above error continuously after that. May I kno why is it happening?
EDIT
This is logcat file
W/dalvikvm( 2694): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime( 2694): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime( 2694): java.lang.NullPointerException
E/AndroidRuntime( 2694): at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime( 2694): at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime( 2694): at android.widget.AbsListView.obtainView(AbsList
View.java:1274)
E/AndroidRuntime( 2694): at android.widget.ListView.makeAndAddView(ListVi
ew.java:1668)
E/AndroidRuntime( 2694): at android.widget.ListView.fillDown(ListView.jav
a:637)
E/AndroidRuntime( 2694): at android.widget.ListView.fillFromTop(ListView.
java:694)
E/AndroidRuntime( 2694): at android.widget.ListView.layoutChildren(ListVi
ew.java:1521)
E/AndroidRuntime( 2694): at android.widget.AbsListView.onLayout(AbsListVi
ew.java:1113)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.RelativeLayout.onLayout(Relati
veLayout.java:900)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:333)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.setChildFrame(Lin
earLayout.java:1119)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.layoutVertical(Li
nearLayout.java:998)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.onLayout(LinearLa
yout.java:918)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:333)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.view.ViewRoot.performTraversals(ViewR
oot.java:996)
E/AndroidRuntime( 2694): at android.view.ViewRoot.handleMessage(ViewRoot.
java:1633)
E/AndroidRuntime( 2694): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 2694): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2694): at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime( 2694): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 2694): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime( 2694): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2694): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime( 2694): at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 2694): GC freed 6621 objects / 343272 bytes in 126ms
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c60cd0 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c58028 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c37fa0 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/Process ( 52): Sending signal. PID: 2694 SIG: 3
I/dalvikvm( 2694): threadid=7: reacting to signal 3
I/dalvikvm( 2694): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 2694): Sending signal. PID: 2694 SIG: 9
I/ActivityManager( 52): Process com.notification (pid 2694) has died.
I/WindowManager( 52): WIN DEATH: Window{44d90538 com.notification/com.notifica
tion.List1 paused=false}
I/UsageStats( 52): Unexpected resume of com.android.launcher while already res
umed in com.notification
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44d933c8
I/ActivityManager( 52): Start proc com.notification for broadcast com.notifica
tion/.AlarmReceiver: pid=2706 uid=10034 gids={3003}
D/ddm-heap( 2706): Got feature list request
D/dalvikvm( 1152): GC freed 194 objects / 8728 bytes in 88ms
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Back
ground }
I/ActivityManager( 52): Displayed activity com.notification/.Background: 262 m
s (total 8081 ms)
D/dalvikvm( 234): GC freed 44 objects / 2064 bytes in 134ms
D/AndroidRuntime( 2718):
D/AndroidRuntime( 2718): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 2718): CheckJNI is ON
D/AndroidRuntime( 2718): --- registering native functions ---
D/ddm-heap( 2718): Got feature list request
D/PackageParser( 52): Scanning package: /data/app/vmdl67950.tmp
I/PackageManager( 52): Removing non-system package:com.notification
D/PackageManager( 52): Removing package com.notification
D/PackageManager( 52): Services: com.notification.BackService
D/PackageManager( 52): Receivers: com.notification.AlarmReceiver
D/PackageManager( 52): Activities: com.notification.NotificationActivity com
.notification.Form1 com.notification.Background com.notification.Bg com.notifica
tion.List1
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44eb1868
D/PackageManager( 52): Scanning package com.notification
I/PackageManager( 52): /data/app/vmdl67950.tmp changed; unpacking
D/installd( 32): DexInv: --- BEGIN '/data/app/vmdl67950.tmp' ---
D/dalvikvm( 2724): DexOpt: load 40ms, verify 159ms, opt 2ms
D/installd( 32): DexInv: --- END '/data/app/vmdl67950.tmp' (success) ---
D/PackageManager( 52): Services: com.notification.BackService
D/PackageManager( 52): Receivers: com.notification.AlarmReceiver
D/PackageManager( 52): Activities: com.notification.NotificationActivity com
.notification.Form1 com.notification.Background com.notification.Bg com.notifica
tion.List1
D/ActivityManager( 52): Uninstalling process com.notification
D/ActivityManager( 52): Force removing process ProcessRecord{44e9eb48 2706:com
.notification/10034} (com.notification/10034)
I/Process ( 52): Sending signal. PID: 2706 SIG: 9
D/ActivityManager( 52): Received spurious death notification for thread androi
d.os.BinderProxy#44eec8b8
I/installd( 32): move /data/dalvik-cache/data#app#vmdl67950.tmp#classes.dex ->
/data/dalvik-cache/data#app#com.notification.apk#classes.dex
D/PackageManager( 52): New package installed in /data/app/com.notification.apk
D/AndroidRuntime( 2718): Shutting down VM
D/dalvikvm( 2718): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 2718): DestroyJavaVM shutting VM down
D/dalvikvm( 2718): HeapWorker thread shutting down
D/dalvikvm( 2718): HeapWorker thread has shut down
D/jdwp ( 2718): JDWP shutting down net...
I/dalvikvm( 2718): Debugger has detached; object registry had 1 entries
D/dalvikvm( 2718): VM cleaning up
D/dalvikvm( 2718): LinearAlloc 0x0 used 623916 of 5242880 (11%)
D/ActivityManager( 52): Uninstalling process com.notification
I/dalvikvm( 2718): JNI: AttachCurrentThread (from ???.???)
E/AndroidRuntime( 2718): ERROR: thread attach failed
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
700e5
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20031
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20030
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
50000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60001
D/dalvikvm( 1152): GC freed 139 objects / 5928 bytes in 230ms
D/dalvikvm( 52): GC freed 14606 objects / 863536 bytes in 259ms
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
700e5
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20031
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20030
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
50000
D/dalvikvm( 52): GC freed 425 objects / 17320 bytes in 275ms
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60001
D/AndroidRuntime( 2729):
D/AndroidRuntime( 2729): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 2729): CheckJNI is ON
D/AndroidRuntime( 2729): --- registering native functions ---
D/ddm-heap( 2729): Got feature list request
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Start proc com.notification for activity com.notificat
ion/.NotificationActivity: pid=2735 uid=10034 gids={3003}
D/AndroidRuntime( 2729): Shutting down VM
D/dalvikvm( 2729): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 2729): DestroyJavaVM shutting VM down
D/dalvikvm( 2729): HeapWorker thread shutting down
D/dalvikvm( 2729): HeapWorker thread has shut down
D/jdwp ( 2729): JDWP shutting down net...
I/dalvikvm( 2729): Debugger has detached; object registry had 1 entries
D/dalvikvm( 2729): VM cleaning up
E/AndroidRuntime( 2729): ERROR: thread attach failed
D/dalvikvm( 2729): LinearAlloc 0x0 used 639500 of 5242880 (12%)
D/dalvikvm( 30): GC freed 299 objects / 11576 bytes in 264ms
D/ddm-heap( 2735): Got feature list request
D/dalvikvm( 30): GC freed 57 objects / 2432 bytes in 160ms
D/dalvikvm( 30): GC freed 2 objects / 48 bytes in 360ms
I/ActivityManager( 52): Displayed activity com.notification/.NotificationActiv
ity: 1204 ms (total 1204 ms)
W/KeyCharacterMap( 2735): No keyboard for id 0
W/KeyCharacterMap( 2735): Using default keymap: /system/usr/keychars/qwerty.kcm.
bin
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Bg (
has extras) }
I/ActivityManager( 52): Displayed activity com.notification/.Bg: 329 ms (total
329 ms)
D/dalvikvm( 1152): GC freed 2454 objects / 141000 bytes in 600ms
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.List
1 bnds=[0,152][480,248] }
W/ActivityManager( 52): startActivity called from non-Activity context; forcin
g Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=com.notification/.List1 bnds=[
0,152][480,248] }
D/AndroidRuntime( 2735): Shutting down VM
W/dalvikvm( 2735): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime( 2735): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime( 2735): java.lang.NullPointerException
E/AndroidRuntime( 2735): at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime( 2735): at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime( 2735): at android.widget.AbsListView.obtainView(AbsList
View.java:1256)
E/AndroidRuntime( 2735): at android.widget.ListView.measureHeightOfChildr
en(ListView.java:1147)
E/AndroidRuntime( 2735): at android.widget.ListView.onMeasure(ListView.ja
va:1060)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.widget.RelativeLayout.measureChild(Re
lativeLayout.java:554)
E/AndroidRuntime( 2735): at android.widget.RelativeLayout.onMeasure(Relat
iveLayout.java:377)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime( 2735): at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.widget.LinearLayout.measureVertical(L
inearLayout.java:464)
E/AndroidRuntime( 2735): at android.widget.LinearLayout.onMeasure(LinearL
ayout.java:278)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime( 2735): at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewRoot.performTraversals(ViewR
oot.java:763)
E/AndroidRuntime( 2735): at android.view.ViewRoot.handleMessage(ViewRoot.
java:1633)
E/AndroidRuntime( 2735): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 2735): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2735): at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime( 2735): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 2735): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime( 2735): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2735): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime( 2735): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 52): Sending signal. PID: 2735 SIG: 3
I/dalvikvm( 2735): threadid=7: reacting to signal 3
I/dalvikvm( 2735): Wrote stack trace to '/data/anr/traces.txt'
W/ActivityManager( 52): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 52): Activity idle timeout for HistoryRecord{44dcace0 com.n
otification/.List1}
I/Process ( 2735): Sending signal. PID: 2735 SIG: 9
I/ActivityManager( 52): Process com.notification (pid 2735) has died.
I/WindowManager( 52): WIN DEATH: Window{44d8db78 com.notification/com.notifica
tion.List1 paused=false}
I/UsageStats( 52): Unexpected resume of com.android.launcher while already res
umed in com.notification
I/ActivityManager( 52): Start proc com.notification for broadcast com.notifica
tion/.AlarmReceiver: pid=2745 uid=10034 gids={3003}
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44f2e3d8
E/gralloc ( 52): [unregister] handle 0x423290 still locked (state=40000001)
D/ddm-heap( 2745): Got feature list request
D/dalvikvm( 1152): GC freed 212 objects / 9560 bytes in 82ms
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Back
ground }
I/ActivityManager( 52): Displayed activity com.notification/.Background: 240 m
s (total 16387 ms)
D/dalvikvm( 234): GC freed 43 objects / 2024 bytes in 152ms
i think your adapter should know which textViewResourceId it should use.
So try this out: ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,R.layout.list_item, R.id.tv1,values);
Change this to
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
this
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
And why do you need listView.setVisibility(0)?
final String[] values = new String[50];
int i=0;
while(cur.moveToNext())
{
values[i]=Integer.toString(cur.getInt(0))+":"+cur.getString(1)+":"+cur.getString(2);
i++;
}
cur.close();
Starting from the this spinet of code.
When the db.query returns you should rewind the cursor before starting to use it in the while loop. What if the query returns more the 50 results? Your app will crash with ArrayOutBoundException
I am having a weird problem.
I am developing a program to log GPS and sensor readings periodically. My friend runs the code on his machine using Eclipse Galileo 3.6 and it works perfectly fine for her.
When I run the code on my machine which has Eclipse Galileo 3.5.2 it shows service stopped unexpectedly.
We have the same JDK version. I am not able to figure out what may be the exact problem.
Please let me know what else information I need to give in order to fix the problem.
logcat
I/ActivityManager( 1104): Start proc com.sensor.test for service com.sensor.test/.SensorReadings: pid=3539 uid=10057 gids={3003, 1015}
D/AndroidRuntime( 3539): Shutting down VM
W/dalvikvm( 3539): threadid=1: thread exiting with uncaught exception (group=0x4001d7e0)
E/AndroidRuntime( 3539): FATAL EXCEPTION: main
E/AndroidRuntime( 3539): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000000 (has extras) } in com.sensor.test.SensorReadings$2#44770958
E/AndroidRuntime( 3539): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:905)
E/AndroidRuntime( 3539): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3539): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3539): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3539): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 3539): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3539): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3539): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 3539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 3539): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3539): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3539): at com.sensor.test.SensorReadings$2.onReceive(SensorReadings.java:327)
E/AndroidRuntime( 3539): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
E/AndroidRuntime( 3539): ... 9 more
W/ActivityManager( 1104): Activity destroy timeout for HistoryRecord{44b38508 com.sensor.test/.MainScreen}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/LocationMasfClient( 1104): getNetworkLocation(): Location not found in cache, making network request
D/LocationMasfClient( 1104): getNetworkLocation(): Number of prefetched entries 10
E/LocationMasfClient( 1104): getNetworkLocation(): Returning *server* computed location with accuracy 28
D/libgps ( 1104): GpsInterface_inject_location( 35.772249, -78.673950, 28.000 )
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder#44963d80}
D/NativeCrypto( 1104): Freeing OpenSSL session
D/dalvikvm( 1104): GC_FOR_MALLOC freed 22104 objects / 1169312 bytes in 128ms
D/NativeCrypto( 1104): Freeing OpenSSL session
I/Process ( 3539): Sending signal. PID: 3539 SIG: 9
W/InputManagerService( 1104): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#44b40dd0
I/ActivityManager( 1104): Process com.sensor.test (pid 3539) has died.
The pertinent code for line 88 with parsing going on:
public void startService(){
//startService(new Intent(MainScreen.this,SensorReadings.class));
Intent intent = new Intent(MainScreen.this, SensorReadings.class);
**intent.putExtra("lp", Integer.parseInt(""+longPeriod.getText()));// LINE 88**
intent.putExtra("gp", Integer.parseInt(""+gpsPeriod.getText()));
intent.putExtra("sp", Integer.parseInt(""+snrPeriod.getText()));
//startActivity(intent);
startService(intent);
}
Thanks.
AG
E/AndroidRuntime( 2934): java.lang.NumberFormatException: unable to parse '' as integer
E/AndroidRuntime( 2934): at java.lang.Integer.parseInt(Integer.java:412)
E/AndroidRuntime( 2934): at java.lang.Integer.parseInt(Integer.java:382)
E/AndroidRuntime( 2934): at com.sensor.test.MainScreen.startService(MainScreen.java:88)
Perhaps at line 88 in MainScreen.java, your startService method is calling Integer.parseInt with an empty string?
Can you show us the pertinent code?
I don't get why you are putting "".
So to be sure this is not the problem try either this:
intent.putExtra("lp", Integer.parseInt(longPeriod.getText()));
intent.putExtra("gp", Integer.parseInt(gpsPeriod.getText()));
intent.putExtra("sp", Integer.parseInt(snrPeriod.getText()));
or
String lp = longPeriod.getText();
String gp = gpsPeriod.getText();
String sp = snrPeriod.getText();
intent.putExtra("lp", Integer.parseInt(lp));
intent.putExtra("gp", Integer.parseInt(gp));
intent.putExtra("sp", Integer.parseInt(sp));
The second way is better for debugging... so you can see what is actually happening.
model : zt180
firmware : android 2.1-update1-20101030
kernel : 2.6.32.9 usbandroid #1608
build number zt180-eng 2.1-update1 20101030
google maps : 4.5.1
Various crashes occur when embedding the google maps component into an android application. I'm connecting to a router via Wi-Fi for internet access. The stand-alone google maps app seems to work fine. To re-produce, start the maps app and begin scrolling around.
Will fail within a couple of minutes, occasionally on start-up (in setContentView). Most of the errors are when drawing tiles in google code. Sometimes just an Android SEGV.
NOTE : I've tested the same app on the Android developer phone 2 (os 1.6), and it works fine.
My android app is as follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="043yBg1m9IiFNKXIhN5LsdeNndw2k7yrw4Ja3xQ"/>
</RelativeLayout>
import com.google.android.maps.MapActivity;
import android.os.Bundle;
public class Maps extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
protected boolean isRouteDisplayed() { return false; }
}
=========================
W/MapActivity( 2745): Recycling dispatcher com.google.googlenav.datarequest.DataRequestDispatcher#45ebcd30
V/MapActivity( 2745): Recycling map object.
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 720 ms (total 720 ms)
I/MapActivity( 2745): Handling network change notification:CONNECTED
E/MapActivity( 2745): Couldn't get connection factory client
D/AndroidRuntime( 2745): Shutting down VM
W/dalvikvm( 2745): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2745): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2745): java.lang.IncompatibleClassChangeError: interface not implemented
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.checkPaintTimeExceeded(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.onDraw(MapView.java:486)
<snip>
I/Process ( 2745): Sending signal. PID: 2745 SIG: 9
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2745) has died.
I/WindowManager( 2010): WIN DEATH: Window{46112878 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite`
======================================================================
I/MapActivity( 2863): Handling network change notification:CONNECTED
E/MapActivity( 2863): Couldn't get connection factory client
D/dalvikvm( 2863): GC freed 8114 objects / 577376 bytes in 86ms
D/dalvikvm( 2863): GC freed 685 objects / 444384 bytes in 85ms
D/dalvikvm( 2863): GC freed 3458 objects / 259456 bytes in 79ms
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 4407 ms (total 4407 ms)
D/AndroidRuntime( 2863): Shutting down VM
W/dalvikvm( 2863): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2863): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2863): java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
E/AndroidRuntime( 2863): at java.util.Vector.elementAt(Vector.java:331)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawTile(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.onDraw(MapView.java:486)
E/AndroidRuntime( 2863): at android.view.View.draw(View.java:6535)
E/AndroidRuntime( 2863): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
E/AndroidRuntime( 2863): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
<snip>
E/AndroidRuntime( 2863): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2010): Sending signal. PID: 2863 SIG: 3
I/dalvikvm( 2863): threadid=7: reacting to signal 3
I/dalvikvm( 2863): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 2863): Sending signal. PID: 2863 SIG: 9
I/WindowManager( 2010): WIN DEATH: Window{460ac708 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2863) has died.
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite
W/InputManagerService( 2010): Got RemoteException sending setActive(false) notification to pid 2863 uid 10046
Basically, lots of bad things start happening...
The ZT-180 does not have Google Maps, AFAIK.