Unable to start activity ComponentInfo (android)
<p>I am getting this error, please help me.</p>

<p>Unable to start activity ComponentInfo{com.example.newandrojenaproject/com.example.newandrojenaproject.MainActivity}: java.lang.NullPointerException</p>

<p>Here is my MainActivity.java</p>

<pre><code>package com.example.newandrojenaproject;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
import com.hp.hpl.jena.query.*;
public class MainActivity extends Activity {
    TextView t;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String str = extractUsingSparql("&lt;http://dbpedia.org/resource/Babur&gt;");
        t = (TextView) findViewById(R.id.textView1);
        if(!str.equalsIgnoreCase("null"))
        t.setText(str);
        else
            t.setText("Null Value Returned");
    }

     public static String extractUsingSparql(String url){

            String abstract1= "";
            String var = "abstract";
            String r="";

            String service = "http://dbpedia.org/sparql";
            String query = "SELECT ?abstract WHERE { { "+url+" &lt;http://dbpedia.org/ontology/abstract&gt; ?abstract. FILTER langMatches( lang(?abstract), 'en') } } ";
            //Abstract
            Query q = QueryFactory.create(query, Syntax.syntaxARQ);
            QueryExecution qe = QueryExecutionFactory.sparqlService(service, q);
            try{
            ResultSet resultSet = qe.execSelect();
            while (resultSet.hasNext()) {
                QuerySolution solution = resultSet.next();
                if (solution.get(var) == null) {

                      System.out.println("{null}");
                      r = "null";

                    } else if (solution.get(var).isLiteral()) {

                      System.out.println (solution.getLiteral(var).toString());
                     r= solution.getLiteral(var).toString();
                    } else {
                      System.out.println(solution.getResource(var).getURI());
                      r = solution.getResource(var).getURI();
                    }
            }
            } 
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
            finally
            {
                qe.close();
            }
            return r;
     }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}
</code></pre>

<p>Here is the XML file:</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" &gt;

    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" /&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>I am not using any other activity. I am using androjena and ARQoid libraries for sparql queries. I don't know where actually the error is and how to solve it!</p>

<p>Here are the errors (LogCat output):</p>

<pre><code>03-19 13:00:29.125: E/AndroidRuntime(832): FATAL EXCEPTION: main
03-19 13:00:29.125: E/AndroidRuntime(832): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newandrojenaproject/com.example.newandrojenaproject.MainActivity}: java.lang.NullPointerException
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.os.Looper.loop(Looper.java:137)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread.main(ActivityThread.java:5039)
03-19 13:00:29.125: E/AndroidRuntime(832):  at java.lang.reflect.Method.invokeNative(Native Method)
03-19 13:00:29.125: E/AndroidRuntime(832):  at java.lang.reflect.Method.invoke(Method.java:511)
03-19 13:00:29.125: E/AndroidRuntime(832):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-19 13:00:29.125: E/AndroidRuntime(832):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-19 13:00:29.125: E/AndroidRuntime(832):  at dalvik.system.NativeStart.main(Native Method)
03-19 13:00:29.125: E/AndroidRuntime(832): Caused by: java.lang.NullPointerException
03-19 13:00:29.125: E/AndroidRuntime(832):  at com.android.internal.os.LoggingPrintStream.println(LoggingPrintStream.java:298)
03-19 13:00:29.125: E/AndroidRuntime(832):  at com.example.newandrojenaproject.MainActivity.extractUsingSparql(MainActivity.java:56)
03-19 13:00:29.125: E/AndroidRuntime(832):  at com.example.newandrojenaproject.MainActivity.onCreate(MainActivity.java:16)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.Activity.performCreate(Activity.java:5104)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-19 13:00:29.125: E/AndroidRuntime(832):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-19 13:00:29.125: E/AndroidRuntime(832):  ... 11 more
</code></pre>
