java - RuntimeException: Unable to instantiate receiver -
i attempting launch activity after screen unlocked , getting error log below. looked @ other posts regarding issue of them solved problem
e/androidruntime: fatal exception: main java.lang.runtimeexception: unable instantiate receiver com.me.phone.receive: java.lang.classnotfoundexception: com.me.phone.receive @ android.app.activitythread.handlereceiver(activitythread.java:2239) @ android.app.activitythread.access$1600(activitythread.java:139) @ android.app.activitythread$h.handlemessage(activitythread.java:1300) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4918) @ java.lang.reflect.method.invokenative(native method)
mainifest
<uses-sdk android:minsdkversion="14" android:targetsdkversion="17" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.receive_user_present" /> <uses-feature android:name="android.hardware.camera" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.me.phone.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <receiver android:name=".recieve" > <intent-filter android:enabled="true" android:exported="false" > <action android:name="android.intent.action.user_present" /> </intent-filter> </receiver> </application> </manifest>
reciever
package com.me.phone; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; public class recieve extends broadcastreceiver{ @override public void onreceive(context context, intent intent) { intent activity = new intent(context, mainactivity.class); activity.addflags(intent.flag_activity_new_task); context.startactivity(activity); } }
could "receive" spelled 2 different ways in example?
from exception:
...java.lang.classnotfoundexception: com.me.phone.receive
from manifest:
<receiver android:name=".recieve" >
Comments
Post a Comment