Exception dispatching input event, while calling startActivity - android

There are several related question already asked on StackOverflow and other forums. But, still this is causing and none of the solution is working for me. Also, I would like to state that I am using device 13'3 inch Braun Tablet.
Flow of application as per Activity,
A Activity calling B Activity and from B I am calling A Activity with flag FLAG_ACTIVITY_CLEAR_TOP and there after process is repeated for Activities from Activity A to Activity B. Below is more detailed explanation
I am calling my MainActivity from a dialog for updating database as below,
Intent intent = new Intent(context, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(context.getString(R.string.IS_UPDATE_DATA), true);
context.startActivity(intent);
And after that I am updating my database from a web-service call using AsyncTask and on completion of update I am using below code to startActivity from onTouch() of Activity,
Intent intent = new Intent(mContext, CategoryActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
This is causing below crash everytime,
01-29 20:21:44.631: E/InputEventReceiver(3213): Exception dispatching input event.
01-29 20:21:44.631: E/MessageQueue-JNI(3213): Exception in MessageQueue callback: handleReceiveCallback
01-29 20:21:44.651: E/MessageQueue-JNI(3213): java.lang.NullPointerException
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.os.Parcel.readException(Parcel.java:1431)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.os.Parcel.readException(Parcel.java:1379)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1892)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1412)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Activity.startActivityForResult(Activity.java:3407)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Activity.startActivityForResult(Activity.java:3368)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Activity.startActivity(Activity.java:3603)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Activity.startActivity(Activity.java:3571)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.brodos.app.storeship.MainActivity.onTouch(MainActivity.java:857)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.View.dispatchTouchEvent(View.java:7258)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2177)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1878)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2177)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1878)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2177)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1878)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2177)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1878)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2470)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1633)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.Activity.dispatchTouchEvent(Activity.java:2428)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2418)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.View.dispatchPointerEvent(View.java:7443)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchPointerEvent(PhoneWindow.java:2323)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3526)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3471)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4612)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4591)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4683)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.os.MessageQueue.nativePollOnce(Native Method)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.os.MessageQueue.next(MessageQueue.java:125)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.os.Looper.loop(Looper.java:124)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at android.app.ActivityThread.main(ActivityThread.java:5063)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at java.lang.reflect.Method.invoke(Method.java:511)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-29 20:21:44.651: E/MessageQueue-JNI(3213): at dalvik.system.NativeStart.main(Native Method)
Let me know if anyone can guide or has a solution for it. Also, let me know if anything is missing in question to be added.

I have been through a quite similar to yours, and the solution has been like this:
if (savedInstanceState != null) {
Intent mIntent = new Intent(context, SomeActivity.class);
mIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(mIntent);
mIntent.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
}

As you are running a AsyncTask, I think you need to start your activity in onPostExecute() method of AsyncTask().

Related

Cannot use android.support.v7.widget.DrawerLayout in Android

I am absolute beginner to Android. I start learning how to use action bar in android very well with navigation drawer. I already created a simple app using android.support.v4.widget.DrawerLayout layout in xml file.
It was working fine. But when I use android.support.v7.widget.DrawerLayout instead, it is throwing error. But when I changed it back to android.support.v4.widget.DrawerLayout,it is working fine.
This is my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- This LinearLayout represents the contents of the screen -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The ActionBar displayed at the top -->
<include
layout="#layout/action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- The main content view where fragments are loaded -->
<FrameLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!-- The navigation drawer that comes from the left -->
<!-- Note that `android:layout_gravity` needs to be set to 'start' -->
<android.support.design.widget.NavigationView
android:id="#+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/white"/>
<!--app:headerLayout="#layout/nav_header"
app:menu="#menu/drawer_view" />-->
</android.support.v7.widget.DrawerLayout>
This is the action_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
</android.support.v7.widget.Toolbar>
This is my MainActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
This is the errors in logcat when I run it
01-29 11:22:43.026 20642-20642/? D/dalvikvm: Late-enabling CheckJNI
01-29 11:22:43.118 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to resolve interface method 17962: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to resolve interface method 17966: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-29 11:22:43.190 20642-20642/com.blog.waiyanhein.llks.llks D/AndroidRuntime: Shutting down VM
01-29 11:22:43.190 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa617d908)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: FATAL EXCEPTION: main
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blog.waiyanhein.llks.llks/com.blog.waiyanhein.llks.llks.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v7.widget.DrawerLayout
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5041)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v7.widget.DrawerLayout
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.blog.waiyanhein.llks.llks.MainActivity.onCreate(MainActivity.java:15)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5104)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:141) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5041) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.DrawerLayout" on path: /data/app/com.blog.waiyanhein.llks.llks-2.apk
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:552)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.blog.waiyanhein.llks.llks.MainActivity.onCreate(MainActivity.java:15) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5104) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:141) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5041) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method) 
What is wrong with my code?
You're getting a ClassNotFoundException because there is no DrawerLayout class in the v7 appcompat library.
They did not update this particular widget, presumably because there wasn't really anything to improve upon functionally, nor anything visual that needed a makeover, as it's just an empty, transparent layout.
Other components that were updated - such as the ActionBarDrawerToggle class - are designed to work with the v4 support library version of DrawerLayout, and, in fact, the v7 library depends on the v4.
TL;DR - Just stick with the v4 DrawerLayout.
Instead of using v7 use v4. Change the
android.support.v7.widget.DrawerLayout
to
android.support.v4.widget.DrawerLayout
Will solve the issue.

Android Closing My Application Without Any Notification

I am working on Card Scanner application, Using native camera and barcode scanning apis in my app(everything is fine with camera and barcode sanning), also using Spring Android library with Java POJO Objects for in/out to Rest apis.
ISSUE
Android is closing my application without any notification, QA reported a bug that he was testing and suddenly app closed(behavior is similar to home button press).
I don't have any idea about this issue. I reproduced this issue at my end and got below mentioned logs in logcat.
Here is my logs:
01-29 14:35:00.805: E/AndroidRuntime(25696): FATAL EXCEPTION: main
01-29 14:35:00.805: E/AndroidRuntime(25696): Process: com.ihi.bcr, PID: 25696
01-29 14:35:00.805: E/AndroidRuntime(25696): java.lang.RuntimeException: Unable to start service com.ihi.bcr.services.ContactSyncService#44e4fbf8 with Intent { flg=0x10000000 cmp=com.ihi.bcr/.services.ContactSyncService }: java.lang.NullPointerException
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2719)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.access$2100(ActivityThread.java:135)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.os.Handler.dispatchMessage(Handler.java:102)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.os.Looper.loop(Looper.java:136)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.main(ActivityThread.java:5017)
01-29 14:35:00.805: E/AndroidRuntime(25696): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 14:35:00.805: E/AndroidRuntime(25696): at java.lang.reflect.Method.invoke(Method.java:515)
01-29 14:35:00.805: E/AndroidRuntime(25696): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-29 14:35:00.805: E/AndroidRuntime(25696): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-29 14:35:00.805: E/AndroidRuntime(25696): at dalvik.system.NativeStart.main(Native Method)
01-29 14:35:00.805: E/AndroidRuntime(25696): Caused by: java.lang.NullPointerException
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.IntentService.onStart(IntentService.java:116)
01-29 14:35:00.805: E/AndroidRuntime(25696): at roboguice.service.RoboIntentService.onStart(RoboIntentService.java:66)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.IntentService.onStartCommand(IntentService.java:130)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702)
01-29 14:35:00.805: E/AndroidRuntime(25696): ... 10 more
01-29 14:35:00.815: W/ActivityManager(780): Force finishing activity com.ihi.bcr/.activity.HomeScreen
01-29 14:35:00.975: E/Database(19015): 0
01-29 14:35:01.185: E/Database(19015): 0
01-29 14:35:01.215: D/audio_hw_primary(184): select_devices: out_snd_device(2: speaker) in_snd_device(0: )
01-29 14:35:01.345: W/ActivityManager(780): Activity pause timeout for ActivityRecord{4382e1c0 u0 com.ihi.bcr/.activity.HomeScreen t171 f}
01-29 14:35:01.405: E/Database(19015): 0
01-29 14:35:01.645: D/dalvikvm(19015): GC_FOR_ALLOC freed 527K, 4% free 17113K/17728K, paused 24ms, total 25ms
NOTE:
ContactSyncService is intent service.
I am starting contactSyncService by startService() method.
I didn't override onStart and onStartCommand() functions of IntentService(As it is mention in Android Docs)
You have missed to call super.onCreate() in your ContactSyncService.onCreate().

Android Quickblox Video chat error

I am developing a video chat application for android using Quickblox library. But I am getting some errors while maintaining video chat session. When user gets logged in as receiver (second user) then app gets crashes after some time giving folowing log output.
01-28 18:23:20.149: W/System.err(15082): at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
01-28 18:23:20.149: W/System.err(15082): at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
01-28 18:23:20.149: W/System.err(15082): at java.io.DataOutputStream.write(DataOutputStream.java:98)
01-28 18:23:20.149: W/System.err(15082): at java.io.OutputStream.write(OutputStream.java:82)
01-28 18:23:20.149: W/System.err(15082): at com.quickblox.module.videochat.core.senders.TcpPacketsSender$TcpVideoAudioSenderRunnable.run(TcpPacketsSender.java:98)
01-28 18:23:20.149: W/System.err(15082): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
01-28 18:23:20.149: W/System.err(15082): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-28 18:23:20.149: W/System.err(15082): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-28 18:23:20.149: W/System.err(15082): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-28 18:23:20.149: W/System.err(15082): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-28 18:23:20.149: W/System.err(15082): at java.lang.Thread.run(Thread.java:856)
01-28 18:23:20.159: W/System.err(15082): Caused by: libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
01-28 18:23:20.159: W/System.err(15082): at libcore.io.Posix.sendtoBytes(Native Method)
01-28 18:23:20.159: W/System.err(15082): at libcore.io.Posix.sendto(Posix.java:146)
01-28 18:23:20.159: W/System.err(15082): at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
01-28 18:23:20.159: W/System.err(15082): at libcore.io.IoBridge.sendto(IoBridge.java:463)
01-28 18:23:20.159: W/System.err(15082): ... 12 more
01-28 18:23:20.199: W/AudioTrack(15082): obtainBuffer() track 0x7e5788 disabled, restarting
01-28 18:23:20.219: W/ilbc-codec(15082): Ignore last 0 bytes
01-28 18:23:20.349: W/System.err(15082): java.net.SocketException: sendto failed: EPIPE (Broken pipe)
01-28 18:23:20.359: W/System.err(15082): at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:496)
01-28 18:23:20.359: W/System.err(15082): at libcore.io.IoBridge.sendto(IoBridge.java:465)
01-28 18:23:20.359: W/System.err(15082): at java.net.PlainSocketImpl.write(PlainSocketImpl.java:507)
01-28 18:23:20.359: W/System.err(15082): at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
01-28 18:23:20.359: W/System.err(15082): at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
01-28 18:23:20.359: W/System.err(15082): at java.io.DataOutputStream.write(DataOutputStream.java:98)
01-28 18:23:20.359: W/System.err(15082): at java.io.OutputStream.write(OutputStream.java:82)
01-28 18:23:20.359: W/System.err(15082): at com.quickblox.module.videochat.core.senders.TcpPacketsSender$TcpVideoAudioSenderRunnable.run(TcpPacketsSender.java:98)
01-28 18:23:20.359: W/System.err(15082): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
01-28 18:23:20.359: W/System.err(15082): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-28 18:23:20.359: W/System.err(15082): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-28 18:23:20.359: W/System.err(15082): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-28 18:23:20.359: W/System.err(15082): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-28 18:23:20.359: W/System.err(15082): at java.lang.Thread.run(Thread.java:856)
01-28 18:23:20.359: W/System.err(15082): Caused by: libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
01-28 18:23:20.369: W/System.err(15082): at libcore.io.Posix.sendtoBytes(Native Method)
01-28 18:23:20.369: W/System.err(15082): at libcore.io.Posix.sendto(Posix.java:146)
01-28 18:23:20.369: W/System.err(15082): at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
01-28 18:23:20.369: W/System.err(15082): at libcore.io.IoBridge.sendto(IoBridge.java:463)
01-28 18:23:20.379: W/System.err(15082): ... 12 more
sometimes it gives AdioRecord error
java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
Anyone have any idea about this or have any other library for chat application integration ?
Thanks
EDIT
Here are some more errors,
01-29 16:38:58.831: E/AndroidRuntime(6775): FATAL EXCEPTION: Thread-3039
01-29 16:38:58.831: E/AndroidRuntime(6775): java.lang.ExceptionInInitializerError
01-29 16:38:58.831: E/AndroidRuntime(6775): at com.quickblox.module.videochat.core.AudioRecorder$AudioRecorderRunnable.run(AudioRecorder.java:123)
01-29 16:38:58.831: E/AndroidRuntime(6775): at java.lang.Thread.run(Thread.java:856)
01-29 16:38:58.831: E/AndroidRuntime(6775): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load ilbc-codec: findLibrary returned null
01-29 16:38:58.831: E/AndroidRuntime(6775): at java.lang.Runtime.loadLibrary(Runtime.java:365)
01-29 16:38:58.831: E/AndroidRuntime(6775): at java.lang.System.loadLibrary(System.java:535)
01-29 16:38:58.831: E/AndroidRuntime(6775): at com.googlecode.androidilbc.Codec.<init>(Codec.java:16)
01-29 16:38:58.831: E/AndroidRuntime(6775): at com.googlecode.androidilbc.Codec.<clinit>(Codec.java:5)
01-29 16:38:58.831: E/AndroidRuntime(6775): ... 2 more
01-29 11:01:15.772: E/AndroidRuntime(18705): FATAL EXCEPTION: main
01-29 11:01:15.772: E/AndroidRuntime(18705): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rechargedoctor.android.app/com.quickblox.videochatsample.ui.ActivityVideoChat}: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1959)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1984)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread.access$600(ActivityThread.java:126)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1150)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.os.Looper.loop(Looper.java:137)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread.main(ActivityThread.java:4456)
01-29 11:01:15.772: E/AndroidRuntime(18705): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 11:01:15.772: E/AndroidRuntime(18705): at java.lang.reflect.Method.invoke(Method.java:511)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
01-29 11:01:15.772: E/AndroidRuntime(18705): at dalvik.system.NativeStart.main(Native Method)
01-29 11:01:15.772: E/AndroidRuntime(18705): Caused by: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.media.AudioRecord.startRecording(AudioRecord.java:534)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.module.videochat.core.AudioRecorder$AudioRecorderRunnable.initRecorder(AudioRecorder.java:97)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.module.videochat.core.AudioRecorder$AudioRecorderRunnable.<init>(AudioRecorder.java:75)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.module.videochat.core.AudioRecorder.startAudioRecorder(AudioRecorder.java:31)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.module.videochat.core.service.QBVideoChatService.startVideoChat(QBVideoChatService.java:93)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.videochatsample.ui.ActivityVideoChat.initViews(ActivityVideoChat.java:69)
01-29 11:01:15.772: E/AndroidRuntime(18705): at com.quickblox.videochatsample.ui.ActivityVideoChat.onCreate(ActivityVideoChat.java:40)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.Activity.performCreate(Activity.java:4465)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-29 11:01:15.772: E/AndroidRuntime(18705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1923)
01-29 11:01:15.772: E/AndroidRuntime(18705): ... 11 more
just copy the libs/armeabi/libilbc-codec file from the Sample-VideoChat-android project to your new project. everything should work fine.
First of all, check, if you copied native library to your project. Than, if you get other errors, try not copy sources of examples into your project, but try to load and run sources of video chat samples, which you can find here https://github.com/QuickBlox/Sample-VideoChat-android

Getting error while running android app (Unable to find explicit activity class) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
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
Improve this question
10-25 05:30:06.560: W/dalvikvm(1428): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-25 05:30:06.670: E/AndroidRuntime(1428): FATAL EXCEPTION: main
10-25 05:30:06.670: E/AndroidRuntime(1428): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.androidhiv/com.example.androidhiv.AllProductsActivity}; have you declared this activity in your AndroidManifest.xml?
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivityForResult(Activity.java:3370)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivityForResult(Activity.java:3331)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivity(Activity.java:3566)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivity(Activity.java:3534)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.example.androidhiv.MainScreenActivity$1.onClick(MainScreenActivity.java:31)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.view.View.performClick(View.java:4204)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.view.View$PerformClick.run(View.java:17355)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Handler.handleCallback(Handler.java:725)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Handler.dispatchMessage(Handler.java:92)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Looper.loop(Looper.java:137)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-25 05:30:06.670: E/AndroidRuntime(1428): at java.lang.reflect.Method.invokeNative(Native Method)
10-25 05:30:06.670: E/AndroidRuntime(1428): at java.lang.reflect.Method.invoke(Method.java:511)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-25 05:30:06.670: E/AndroidRuntime(1428): at dalvik.system.NativeStart.main(Native Method)
Make sure that this Activity is register in Android Manifeast
You have not declared your Activity AllProductsActivity in your manifest file and the compiler is unable to find that Activity hence throwing error.
Declare Activity AllProductsActivity in your manifest file.
like this
<activity android:name="com.example.androidhiv.AllProductsActivity"
></activity>
Its showing that you have not declared your AllProductsActivity in your manifest file.
<activity
android:name="com.example.androidhiv.AllProductsActivity"
/>
You had to declare each and every Acticity which you want to show in your application it had to be declare in AndroidManifest.xml file.
<activity android:name="com.example.androidhiv.AllProductsActivity" />

Please Help me Understand how to detect errors in my program from logcat [closed]

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.
My app has stopped working on the emulator"Unfortunately". I have the logcat with me, however I dont understand how to solve the errors. Please help me. Thanks in advance. Here's the logcat
05-07 14:34:01.302: E/AndroidRuntime(713): FATAL EXCEPTION: main
05-07 14:34:01.302: E/AndroidRuntime(713): java.lang.RuntimeException: Unable to start activity ComponentInfo{my.calc/my.calc.CalcActivity}: java.lang.NullPointerException
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.os.Looper.loop(Looper.java:137)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-07 14:34:01.302: E/AndroidRuntime(713): at java.lang.reflect.Method.invokeNative(Native Method)
05-07 14:34:01.302: E/AndroidRuntime(713): at java.lang.reflect.Method.invoke(Method.java:511)
05-07 14:34:01.302: E/AndroidRuntime(713): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-07 14:34:01.302: E/AndroidRuntime(713): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-07 14:34:01.302: E/AndroidRuntime(713): at dalvik.system.NativeStart.main(Native Method)
05-07 14:34:01.302: E/AndroidRuntime(713): Caused by: java.lang.NullPointerException
05-07 14:34:01.302: E/AndroidRuntime(713): at my.calc.CalcActivity.onCreate(CalcActivity.java:30)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.Activity.performCreate(Activity.java:4465)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-07 14:34:01.302: E/AndroidRuntime(713): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-07 14:34:01.302: E/AndroidRuntime(713): ... 11 more
Caused by: java.lang.NullPointerException
the above line indicates you have null pointer exception and the below indicated the line number(CalcActivity.java:30).
05-07 14:34:01.302: E/AndroidRuntime(713): at my.calc.CalcActivity.onCreate(CalcActivity.java:30)
and hopefully you may had forget to use setContentView in oncreate() and using xml file components.
Updated:::
adapter = new ArrayAdapter<CharSequence>(CalcActivity.this,android.R.layout.simple_spinner_dropdown_item, your_array_list_of_charsequence);
try by adding above line before adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Just to explain what all those "at"s mean... It's called a stack trace and is a way for you to determine what your application was doing when something went wrong. Imagine you have the following PseudoCode
File1:
1 define function MyFunction(SomeParam)
2 Throw an exception here
3 end definition
File2:
1 DoSomething()
2 DoSomethingElse()
3 Call MyFunction
4 DoSomething()
What you would see in the stack trace is something like
Exception Thrown
at File1 Line 2
at File2 Line 3
This is telling you that the exception is thrown in your MyFunction in File1 when it is being called from File2.
Obviously, in a real program, lots of functions call lots of other functions so stack traces can be quite a bit longer - but the principle is the same.
One other thing to be aware of when using frameworks is that it's possible for the exception to be thrown in code you haven't written yourself. This either means you're using the framework wrong or the framework has a bug. 99% of the time it's because you're using it wrong
If it's a framework exception, follow back up the stack trace until you find the bit of code you've written which is calling the framework. This is most likely where the problem is.
Hope that helps clarify what you're seeing

Categories

Resources