I am using startActivity to call another Activity and I get the \"Activity Not Found Exception\". Here is my code:
TextView textView = (TextView) itemClic
Try adding activity to AndroidManifest.xml
<activity android:name=".MyActivity" />
Not only need you add your Activity in AndroidMainifest.xml like this:
<activity
android:name=".MyActivity"
></activity>
but also you should confirm your package path.
For example,my activity is in com.demo package. The head of the AndroidMainifest should write the same package path,like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo"
android:versionCode="1"
android:versionName="1.0" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.salvopaverani.databes"
android:versionCode="1"
android:versionName="1.1" >
At manifest file, i try to change the android:versionName from 1.0 to 1.1 and everything OK.
I was trying to start SERVICE with startActivity(intent)
and the same exception popped out. To run SERVICE, use startService(intent)
In addition to the answer which Unfrog has given.
One way to get the NullPointerException
is to execute a code which is referring to the view parts before the setContentView()
.
Stuck with the same error for an hour only to realize that I have to clean and build again. Apparently, some times changes in xml do not reflect until we clean and rebuild.