ImageButton not opening sliding menu Android - android

So what im trying to do is use an ImageButton with and onClick to open the android side menu but i keep getting an error.
home.xml (where the ImageButton is located with the onClick)
<ImageButton
android:id="#+id/imgViewRefresh4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:visibility="gone"
android:onClick="click1"
style="?android:attr/borderlessButtonStyle"
android:src="#drawable/slide4" />
MainActivity.java (where the onClick is called)
public void click1(){
mDrawerLayout.openDrawer(mDrawerList);
}
Logcat error
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: FATAL EXCEPTION: main
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: java.lang.IllegalStateException: Could not find a method click1(View) in the activity class com.projects.quickyAB.MainActivity for onClick handler on view class android.widget.ImageButton with id 'imgViewRefresh4'
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.view.View$1.onClick(View.java:3825)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.view.View.performClick(View.java:4475)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.view.View$PerformClick.run(View.java:18796)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:730)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:92)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
12-13 21:38:01.276 3949-3949/com.projects.quickyAB E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5455)

You have to change your method like this to handle the click
public void click1(View v){
mDrawerLayout.openDrawer(mDrawerList);
}

Related

Fabric crash at startup

My app crashed at this line inside onCreate() function
Fabric.with(this, new Crashlytics());
The device is SAMSUNG SM-G313 HZ, running 4.4.2
I've reported to their Twitter dev forum, but my post is automarked as spam.
Anybody knows a workaround?
This is the onCreate function:
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
graph = ObjectGraph.create(getModules());
ImageLoaderConfiguration imageLoaderConfiguration =
ImageLoaderConfiguration.
createDefault(getApplicationContext());
ImageLoader.getInstance().init(imageLoaderConfiguration);
MMX.init(this, R.raw.initfile);
MMX.registerListener(new MessageEventListenerForLockScreen(this));
Intent intent = new Intent(getString(R.string.wake_up_key));
MMX.registerWakeupBroadcast(intent);
}
I've already declared fabric in AndroidManifest
<meta-data
android:name="io.fabric.ApiKey"
android:value="mykeyhere_a1cff923b11afaab1be7b005474d99b912b3"/>
Logcat:
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: FATAL EXCEPTION: main
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: Process: funride.android.com.rideshare, PID: 16717
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: java.lang.VerifyError: com/crashlytics/android/core/CrashlyticsCore
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at funride.android.com.rideshare.application.CloudBikeApp.onCreate(CloudBikeApp.java:33)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4593)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5344)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:676)
10-06 13:31:53.452 16717-16717/funride.android.com.rideshare E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
It may be a conflict with third-party libraries, I had a similar crash when using Retrofit2, because Fabric uses an older version of Retrofit.
It may be that you are using the retrofit 2.0 beta?
Twitter currently uses retrofit 1.8 and won't update until the final release of retrofit 2.0
Discussion that will hopefully be updated when it's fixed can be found here: https://twittercommunity.com/t/java-lang-verifyerror/53974

Zbar : startPreview failed in galaxy S3

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

ActionBarSherlock raises Exception

I have a problem with implementing ActionBarSherlock in my test application.
If the main Activity is a subclass of Activity everything works perfectly, but when I subclass SherlockActivity I get an exception:
12-13 11:33:02.630: E/AndroidRuntime(11345): FATAL EXCEPTION: main
12-13 11:33:02.630: E/AndroidRuntime(11345): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pl.lsi.test.packages/pl.lsi.test.packages.MainActivity}: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.os.Looper.loop(Looper.java:137)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-13 11:33:02.630: E/AndroidRuntime(11345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.NativeStart.main(Native Method)
12-13 11:33:02.630: E/AndroidRuntime(11345): Caused by: java.lang.ClassNotFoundException: pl.lsi.test.packages.MainActivity
12-13 11:33:02.630: E/AndroidRuntime(11345): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-13 11:33:02.630: E/AndroidRuntime(11345): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
12-13 11:33:02.630: E/AndroidRuntime(11345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
12-13 11:33:02.630: E/AndroidRuntime(11345): ... 11 more
I also have a problem with applying SherlockTheme to the manifest (Sherlock styles is not visible).
Then in values folder you have to add styles in styles.xml file....
I think you are missing the some file to place there

Spinner on an ActionBar issue on a Dialog Activity

Hi I have an activity that shows a dialog form an standard layout.
android:theme="#android:style/Theme.Holo.Light.Dialog"/>
I was trying to add a simple spinner to the actionbar but I am having issues and error in the line getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST).
When I change my theme to a common activity it works perfect.
This are the errors showed by the logcat:
3114-3114/org.PeteProto E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.PeteProto/org.PeteProto.Detail}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.PeteProto.Detail.onCreate(Detail.java:30)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more

Phonegap Android facebook plugin crashes

I am getting the error below when I try to login through facebook plugin for Android.
The app basically crashes "stopped", Any ideas will be appreciated.
ERROR/AndroidRuntime(2008): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to resume activity {xxx/com.facebook.LoginActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x7f060012
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2742)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f060012
at android.content.res.Resources.getText(Resources.java:230)
at android.content.res.Resources.getString(Resources.java:314)
at android.content.Context.getString(Context.java:327)
at com.facebook.widget.WebDialog.onCreate(WebDialog.java:189)
at android.app.Dialog.dispatchOnCreate(Dialog.java:355)
at android.app.Dialog.show(Dialog.java:260)
at com.facebook.AuthorizationClient$WebViewAuthHandler.tryAuthorize(AuthorizationClient.java:471)
at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:214)
at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:193)
at com.facebook.AuthorizationClient.authorize(AuthorizationClient.java:121)
at com.facebook.AuthorizationClient.startOrContinueAuth(AuthorizationClient.java:102)
at com.facebook.LoginActivity.onResume(LoginActivity.java:113)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
at android.app.Activity.performResume(Activity.java:5182)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
... 12 more
i kinda resolved it, i deleted the app_id string. turns out facebook plugin doesn't use that.

Categories

Resources