08-22 15:28:41.848: E/Trace(678): error opening trace file: No such file or directory (2)
08-22 15:28:42.387: D/AndroidRuntime(678): Shutting down VM
08-22 15:28:42.387: W/dalvikvm(678): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-22 15:28:42.407: E/AndroidRuntime(678): FATAL EXCEPTION: main
08-22 15:28:42.407: E/AndroidRuntime(678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vikram.custummenuactivity/com.vikram.custummenuactivity.CustumMenuActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:137)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-22 15:28:42.407: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 15:28:42.407: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 15:28:42.407: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-22 15:28:42.407: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-22 15:28:42.407: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
08-22 15:28:42.407: E/AndroidRuntime(678): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ListActivity.onContentChanged(ListActivity.java:243)
08-22 15:28:42.407: E/AndroidRuntime(678): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:259)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.Activity.setContentView(Activity.java:1867)
08-22 15:28:42.407: E/AndroidRuntime(678): at com.vikram.custummenuactivity.CustumMenuActivity.onCreate(CustumMenuActivity.java:24)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.Activity.performCreate(Activity.java:5008)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-22 15:28:42.407: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-22 15:28:42.407: E/AndroidRuntime(678): ... 11 more
08-22 15:33:42.558: I/Process(678): Sending signal. PID: 678 SIG: 9
So problem shouldn't be tricky. Your problem is:
Caused by: java.lang.RuntimeException: Your content must have a
ListView whose id attribute is 'android.R.id.list'
It means that you ListView should have id attibute android.R.id.list
<ListView
android:id="#android:id/list"
...
/>
Similar topic:
runtime exception ListView whose id attribute is
'android.R.id.list'
From your stack trace:
"Your content must have a ListView whose id attribute is 'android.R.id.list". Add this id to the appropriate element in your XML layout file, for example:
Related
I am facing a very weird problem while configuring Tesseract in Android. Following all required steps described here and SO like this and this i have imported tess-two library in eclipse. NDK-build and ant release was also successfull. I have used latest ndk version and android sdk v19(4.4.2).
Next, i had imported a sample project in eclipse written in above blog. All were build successfully. But, when i run the project in a real device, it gives me such a weird error in onPhotoTaken event that possible google search can't answer me nothing!
Logcat says:
08-22 15:04:44.812: V/SimpleAndroidOCR.java(16578): Before baseApi
08-22 15:04:44.812: D/dalvikvm(16578): Trying to load lib /data/app-lib/com.datumdroid.android.ocr.simple-1/liblept.so 0x41e56b50
08-22 15:04:44.822: D/dalvikvm(16578): GC_CONCURRENT freed 1K, 14% free 4989K/5788K, paused 2ms+2ms, total 18ms
08-22 15:04:44.822: E/dalvikvm(16578): dlopen("/data/app-lib/com.datumdroid.android.ocr.simple-1/liblept.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "liblept.so"...
08-22 15:04:44.832: W/dalvikvm(16578): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/googlecode/tesseract/android/TessBaseAPI;
08-22 15:04:44.832: D/AndroidRuntime(16578): Shutting down VM
08-22 15:04:44.832: W/dalvikvm(16578): threadid=1: thread exiting with uncaught exception (group=0x41be0930)
08-22 15:04:44.832: E/AndroidRuntime(16578): FATAL EXCEPTION: main
08-22 15:04:44.832: E/AndroidRuntime(16578): java.lang.ExceptionInInitializerError
08-22 15:04:44.832: E/AndroidRuntime(16578): at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:211)
08-22 15:04:44.832: E/AndroidRuntime(16578): at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onActivityResult(SimpleAndroidOCRActivity.java:135)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.Activity.dispatchActivityResult(Activity.java:5302)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.deliverResults(ActivityThread.java:3315)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2729)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.os.Looper.loop(Looper.java:137)
08-22 15:04:44.832: E/AndroidRuntime(16578): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-22 15:04:44.832: E/AndroidRuntime(16578): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 15:04:44.832: E/AndroidRuntime(16578): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 15:04:44.832: E/AndroidRuntime(16578): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
08-22 15:04:44.832: E/AndroidRuntime(16578): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
08-22 15:04:44.832: E/AndroidRuntime(16578): at dalvik.system.NativeStart.main(Native Method)
08-22 15:04:44.832: E/AndroidRuntime(16578): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "liblept.so"...
08-22 15:04:44.832: E/AndroidRuntime(16578): at java.lang.Runtime.loadLibrary(Runtime.java:371)
08-22 15:04:44.832: E/AndroidRuntime(16578): at java.lang.System.loadLibrary(System.java:535)
08-22 15:04:44.832: E/AndroidRuntime(16578): at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
08-22 15:04:44.832: E/AndroidRuntime(16578): ... 17 more
Probably the most important part of this error message is:
08-22 15:04:44.832: E/AndroidRuntime(16578): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "liblept.so"...
I checked liblept.so is inside the libs folder of library project that i referenced in my sample project.
Can anyone point me the solution or suggestion of this time-killing problem? Thanks in advance.
There seems to be a problem with the NDK toolchain version 4.9.
Try pulling the latest version of the tess-two library code, which includes the following in its Application.mk:
NDK_TOOLCHAIN_VERSION := 4.8
You will need to use the "ndk32" version of the NDK for 32-bit targets.
I have sample application to read from serial port from here.
I have set device to ttyUSB1(usbserial) and Baud rate to 9600 .
but when I click on console I am getting Error: You do not have read/write permission to the serial port
my logcat is
08-22 15:01:25.210: W/System.err(14524): java.io.IOException: Error running exec(). Command:
[/system/bin/su] Working Directory: null Environment: null
08-22 15:01:25.210: W/System.err(14524): at
java.lang.ProcessManager.exec(ProcessManager.java:211)
08-22 15:01:25.211: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:168)
08-22 15:01:25.211: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:241)
08-22 15:01:25.212: W/System.err(14524): at java.lang.Runtime.exec(Runtime.java:184)
08-22 15:01:25.212: W/System.err(14524): at android_serialport_api.SerialPort.<init>
(SerialPort.java:47)
08-22 15:01:25.212: W/System.err(14524): at
android_serialport_api.sample.Application.getSerialPort(Application.java:46)
08-22 15:01:25.213: W/System.err(14524): at
android_serialport_api.sample.SerialPortActivity.onCreate(SerialPortActivity.java:78)
08-22 15:01:25.213: W/System.err(14524): at
android_serialport_api.sample.Sending01010101Activity.onCreate(Sending01010101Activity.java:31)
08-22 15:01:25.214: W/System.err(14524): at
android.app.Activity.performCreate(Activity.java:5020)
08-22 15:01:25.214: W/System.err(14524): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-22 15:01:25.214: W/System.err(14524): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
08-22 15:01:25.214: W/System.err(14524): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
08-22 15:01:25.215: W/System.err(14524): at
android.app.ActivityThread.access$600(ActivityThread.java:149)
08-22 15:01:25.215: W/System.err(14524): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
08-22 15:01:25.215: W/System.err(14524): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-22 15:01:25.216: W/System.err(14524): at android.os.Looper.loop(Looper.java:153)
08-22 15:01:25.216: W/System.err(14524): at
android.app.ActivityThread.main(ActivityThread.java:4987)
08-22 15:01:25.216: W/System.err(14524): at java.lang.reflect.Method.invokeNative(Native
Method)
08-22 15:01:25.216: W/System.err(14524): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 15:01:25.217: W/System.err(14524): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
08-22 15:01:25.217: W/System.err(14524): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
08-22 15:01:25.217: W/System.err(14524): at dalvik.system.NativeStart.main(Native Method)
08-22 15:01:25.217: W/System.err(14524): Caused by: java.io.IOException: No such file or
directory
08-22 15:01:25.218: W/System.err(14524): at java.lang.ProcessManager.exec(Native Method)
08-22 15:01:25.219: W/System.err(14524): at
java.lang.ProcessManager.exec(ProcessManager.java:209)
08-22 15:01:25.219: W/System.err(14524): ... 21 more
How can I resolve this.
please help to solve this.
If you are using serial port application go to file SerialPort.java
change the line:
su = Runtime.getRuntime().exec("/system/bin/su");
to
su = Runtime.getRuntime().exec("/system/xbin/su");
Error: You do not have read/write permission to the serial port
Just change bin to xbin.
like this, Runtime.getRuntime().exec("/system/xbin/su");
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have five tabs in my application say A,B,C,D and E.My problem is that application stopped while changing the tab from B to any other tabs and rotating the device into landscape mode or portrait mode.
Error log is
08-22 11:27:22.835: E/AndroidRuntime(5992): FATAL EXCEPTION: main
08-22 11:27:22.835: E/AndroidRuntime(5992): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nv.netmdapp1/com.nv.netmdapp1.Home}: java.lang.NullPointerException
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3351)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread.access$700(ActivityThread.java:123)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.os.Looper.loop(Looper.java:137)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-22 11:27:22.835: E/AndroidRuntime(5992): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 11:27:22.835: E/AndroidRuntime(5992): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 11:27:22.835: E/AndroidRuntime(5992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-22 11:27:22.835: E/AndroidRuntime(5992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-22 11:27:22.835: E/AndroidRuntime(5992): at dalvik.system.NativeStart.main(Native Method)
08-22 11:27:22.835: E/AndroidRuntime(5992): Caused by: java.lang.NullPointerException
08-22 11:27:22.835: E/AndroidRuntime(5992): at com.nv.netmdapp1.ScheduleDailyView.onActivityCreated(ScheduleDailyView.java:89)
08-22 11:27:22.835: E/AndroidRuntime(5992): at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1468)
Java code given below.
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
dailyFragment = (SherlockFragment) Fragment.instantiate(appContext, AppointmentDailyView.class.getName(),arguments);
weeklyFragment=(SherlockFragment) Fragment.instantiate(appContext, AppointmentWeeklyView.class.getName(),arguments);
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment lastFrag = getFragmentManager().findFragmentByTag("appointmentFrag");
if(lastFrag!=null)
ft.remove(lastFrag);
ft.replace(R.id.ll_appointment_layout, dailyFragment);
ft.commit();
}
#Override
public void onClick(View view)
{
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment lastFrag = getFragmentManager().findFragmentByTag("appointmentFrag");
if(lastFrag!=null)
ft.remove(lastFrag);
if(view==btnDaily)
ft.replace(R.id.ll_appointment_layout, dailyFragment);
else
ft.replace(R.id.ll_appointment_layout, weeklyFragment);
ft.commit();
}
When clicking Tab C this part is executed.But while rotating the device control goes to onActivityCreated() of Tab B.
Here null pointer exception occurring line ScheduleDailyView.java:89 is associated with Tab B.But while rotating the device control goes from tab C and D to this file.What is the reason?
Add the android:configChanges="orientation" in the android manifest, it handles the orientation change event in application.
Manifest:
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:configChanges="orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope helpful to you..
Rotating the Device restarts your app again:
OnActivityCreated Method is called and you are getting a null pointer exception here:
Caused by: java.lang.NullPointerException
08-20 16:54:43.319: E/AndroidRuntime(5646): at com.nv.netmdapp1.ScheduleDailyView.onActivityCreated(ScheduleDailyView.java:89)
Check what is null here, also you can avoid restarting your activity on rotation by handling configuration changes.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
05-08 11:04:12.336: E/AndroidRuntime(678): FATAL EXCEPTION: main
05-08 11:04:12.336: E/AndroidRuntime(678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android/com.android.Calendar_googleActivity}: android.os.NetworkOnMainThreadException
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:137)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-08 11:04:12.336: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
05-08 11:04:12.336: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:511)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-08 11:04:12.336: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
05-08 11:04:12.336: E/AndroidRuntime(678): Caused by: android.os.NetworkOnMainThreadException
05-08 11:04:12.336: E/AndroidRuntime(678): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
05-08 11:04:12.336: E/AndroidRuntime(678): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
05-08 11:04:12.336: E/AndroidRuntime(678): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
05-08 11:04:12.336: E/AndroidRuntime(678): at java.net.InetAddress.getAllByName(InetAddress.java:220)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:432)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
05-08 11:04:12.336: E/AndroidRuntime(678): at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:164)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:88)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:814)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.client.googleapis.json.GoogleJsonResponseException.execute(GoogleJsonResponseException.java:182)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:115)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:112)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.google.api.services.calendar.Calendar$CalendarList$List.execute(Calendar.java:510)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.android.Calendar_googleActivity.onAuthToken(Calendar_googleActivity.java:267)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.android.Calendar_googleActivity.gotAccount(Calendar_googleActivity.java:118)
05-08 11:04:12.336: E/AndroidRuntime(678): at com.android.Calendar_googleActivity.onCreate(Calendar_googleActivity.java:108)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.Activity.performCreate(Activity.java:4465)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-08 11:04:12.336: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-08 11:04:12.336: E/AndroidRuntime(678): ... 11 more
Caused by: android.os.NetworkOnMainThreadException
You've always been warned against doing networking on the UI thread as that could lead to UI lag and application not responding errors if the network operation is delayed.
In recent releases you are now actually prohibited - by the proactive error above - from attempting to 'get away with it'
So get your network usage off of the UI thread and you should be all set. We do not need to discuss how to do that here - it's well covered in the documentation and previous questions.
I having abit of problem here as when i saw somewhere with calculator codes and use it somehow the app always force close when i started keying in numbers. help?
public void onClickListener8(View v)
{
vibrator.vibrate(30);
if(press=='=')
{
onClickListenerReset(buttonClear);
}
eight=(String)button8.getText();
sum=sum+eight;
editText.setText(sum);
}
04-17 15:38:23.110: E/AndroidRuntime(678): FATAL EXCEPTION: main
04-17 15:38:23.110: E/AndroidRuntime(678): java.lang.IllegalStateException: Could not execute method of the activity
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$1.onClick(View.java:2144)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View.performClick(View.java:2485)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$PerformClick.run(View.java:9080)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Handler.handleCallback(Handler.java:587)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:92)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:123)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:507)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-17 15:38:23.110: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): Caused by: java.lang.reflect.InvocationTargetException
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:507)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$1.onClick(View.java:2139)
04-17 15:38:23.110: E/AndroidRuntime(678): ... 11 more
04-17 15:38:23.110: E/AndroidRuntime(678): Caused by: java.lang.SecurityException: Requires VIBRATE permission
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Parcel.readException(Parcel.java:1322)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Parcel.readException(Parcel.java:1276)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.IVibratorService$Stub$Proxy.vibrate(IVibratorService.java:106)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Vibrator.vibrate(Vibrator.java:52)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.mypackage.Calculator.onClickListener8(Calculator.java:232)
04-17 15:38:23.110: E/AndroidRuntime(678): ... 14 more
Make sure your app has the Vibrate permission. The following line should be there in the manifest:
<uses-permission android:name="android.permission.VIBRATE"/>
I think you must be using an emulator. Just comment out the vibrate; somehow that's the cause of the issue.