1. Are you ready for the Galaxy S20? Here is everything we know so far!

Unable to start activity

Discussion in 'Android Development' started by waltenio, Apr 21, 2012.

  1. waltenio

    waltenio Lurker
    Thread Starter

    I got a error message "04-21 18:02:01.448: E/AndroidRuntime(328): java.lang.RuntimeException: Unable to start activity ComponentInfo{pac.bib/pac.bib.LivroBibliaActivity}: java.lang.NullPointerException" when click ListView.
    when try startActivity

    Can help???

    my code is:

    Code (Text):
    1. [B]private AdapterView.OnItemClickListener onListClick=new AdapterView.OnItemClickListener() {
    2.             public void onItemClick(AdapterView<?> parent,
    3.                                     View view, int position,
    4.                                     long id)
    5.             {                      
    6.                
    7.                 Intent i=new Intent(pac.bib.IniciaLivroActivity.this, pac.bib.LivroBibliaActivity.class);
    8.  
    9.                 i.putExtra(ID_EXTRA, String.valueOf(id));                    
    10.          [COLOR=Red]
    11.                 startActivity(i);[/COLOR]              
    12.             }
    13.         };[/B]
    14.  
    15. my AndroidManifest.xml is:
    16.  
    17. [B]<?xml version="1.0" encoding="utf-8"?>
    18. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    19.     package="pac.bib"
    20.     android:versionCode="1"
    21.     android:versionName="1.0" >
    22.  
    23.     <uses-sdk android:minSdkVersion="8" />
    24.  
    25.     <application
    26.         android:icon="@drawable/ic_launcher"
    27.         android:label="@string/app_name" >
    28.         <activity
    29.             android:name=".BibPilotoActivity"
    30.             android:label="@string/app_name" >
    31.             <intent-filter>
    32.                 <action android:name="android.intent.action.MAIN" />
    33.                 <category android:name="android.intent.category.LAUNCHER" />
    34.             </intent-filter>
    35.         </activity>
    36.         <activity android:name=".IniciaLivroActivity"></activity>
    37.         <activity android:name=".LivroBibliaActivity"></activity>
    38.     </application>
    39.  
    40. </manifest>
    41.  
    42. [/B]
     



    1. Download the Forums for Android™ app!


      Download

       
  2. jonbonazza

    jonbonazza Android Expert

    can we see the whole log cat ouput?

    And also, please go back and place your code in
    Code (Text):
    1.  tags so it retains its formatting.
     
  3. waltenio

    waltenio Lurker
    Thread Starter

    Here is LogCat


    05-02 00:56:48.487: E/AndroidRuntime(324): FATAL EXCEPTION: main
    05-02 00:56:48.487: E/AndroidRuntime(324): java.lang.RuntimeException: Unable to start activity ComponentInfo{pac.bib/pac.bib.LivroBibliaActivity}: java.lang.NullPointerException
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.os.Handler.dispatchMessage(Handler.java:99)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.os.Looper.loop(Looper.java:123)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread.main(ActivityThread.java:4627)
    05-02 00:56:48.487: E/AndroidRuntime(324): at java.lang.reflect.Method.invokeNative(Native Method)
    05-02 00:56:48.487: E/AndroidRuntime(324): at java.lang.reflect.Method.invoke(Method.java:521)
    05-02 00:56:48.487: E/AndroidRuntime(324): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    05-02 00:56:48.487: E/AndroidRuntime(324): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    05-02 00:56:48.487: E/AndroidRuntime(324): at dalvik.system.NativeStart.main(Native Method)
    05-02 00:56:48.487: E/AndroidRuntime(324): Caused by: java.lang.NullPointerException
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
    05-02 00:56:48.487: E/AndroidRuntime(324): at pac.bib.LivroHelper.getCursor(LivroHelper.java:163)
    05-02 00:56:48.487: E/AndroidRuntime(324): at pac.bib.LivroBibliaActivity.onCreate(LivroBibliaActivity.java:59)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    05-02 00:56:48.487: E/AndroidRuntime(324): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    05-02 00:56:48.487: E/AndroidRuntime(324): ... 11 more
     
  4. jonbonazza

    jonbonazza Android Expert

    Your problem isn't that you can't start an Activity, but you are receiving a NullPointerException. This means you are trying to access and object that hasn't been initialized.
     
Loading...
Similar Threads - Unable start activity
  1. jhall68w
    Replies:
    5
    Views:
    464
  2. Ajrox22
    Replies:
    9
    Views:
    502
  3. MarcoGalaxyA10
    Replies:
    1
    Views:
    1,202
  4. FaustBottomText
    Replies:
    3
    Views:
    1,175
  5. xarzu
    Replies:
    2
    Views:
    1,118
  6. GlitchedFolx
    Replies:
    16
    Views:
    3,037
  7. aj4yourhelp
    Replies:
    0
    Views:
    1,155
  8. Ian Preddy
    Replies:
    13
    Views:
    5,523
  9. Magixsword
    Replies:
    0
    Views:
    1,052
  10. kumaranil13k
    Replies:
    0
    Views:
    2,700

Share This Page

Loading...