I am a beginner in android..Can anyone tell me how to debug android script and how breakpoints and logcat works? What are the things in the logcat? I tried searching for this...But i couldnt find any!! this is my logcat
05-07 13:22:31.058: I/dalvikvm(609): Could not find method
android.content.pm.PackageManager.getActivityLogo, referenced from method
android.support.v7.internal.widget.ActionBarView.<init>
05-07 13:22:31.058: W/dalvikvm(609): VFY: unable to resolve virtual method 318:
Landroid/content/pm/PackageManager;.getActivityLogo
(Landroid/content/ComponentName;)Landroid/graphics/drawable/Drawable;
05-07 13:22:31.058: D/dalvikvm(609): VFY: replacing opcode 0x6e at 0x008b
05-07 13:22:31.058: I/dalvikvm(609): Could not find method
android.content.pm.ApplicationInfo.loadLogo, referenced from method
android.support.v7.internal.widget.ActionBarView.<init>
05-07 13:22:31.068: W/dalvikvm(609): VFY: unable to resolve virtual method 314:
Landroid/content/pm/ApplicationInfo;.loadLogo
(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
05-07 13:22:31.088: D/dalvikvm(609): VFY: replacing opcode 0x6e at 0x0099
05-07 13:22:31.108: D/dalvikvm(609): VFY: dead code 0x008e-0092 in
Landroid/support/v7/internal/widget/ActionBarView;.<init>
(Landroid/content/Context;Landroid/util/AttributeSet;)V
05-07 13:22:31.108: D/dalvikvm(609): VFY: dead code 0x009c-00a0 in
Landroid/support/v7/internal/widget/ActionBarView;.<init>
(Landroid/content/Context;Landroid/util/AttributeSet;)V
05-07 13:22:31.458: D/AndroidRuntime(609): Shutting down VM
05-07 13:22:31.458: W/dalvikvm(609): threadid=1: thread exiting with uncaught exception
(group=0x4001d800)
05-07 13:22:31.478: E/AndroidRuntime(609): FATAL EXCEPTION: main
05-07 13:22:31.478: E/AndroidRuntime(609): java.lang.RuntimeException: Unable to start
activity ComponentInfo{newapp.com/newapp.com.MainActivity}:
java.lang.NullPointerException
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.os.Handler.dispatchMessage(Handler.java:99)
05-07 13:22:31.478: E/AndroidRuntime(609): at android.os.Looper.loop(Looper.java:123)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread.main(ActivityThread.java:4627)
05-07 13:22:31.478: E/AndroidRuntime(609): at
java.lang.reflect.Method.invokeNative(Native Method)
05-07 13:22:31.478: E/AndroidRuntime(609): at
java.lang.reflect.Method.invoke(Method.java:521)
05-07 13:22:31.478: E/AndroidRuntime(609): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-07 13:22:31.478: E/AndroidRuntime(609): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-07 13:22:31.478: E/AndroidRuntime(609): at dalvik.system.NativeStart.main(Native
Method)
05-07 13:22:31.478: E/AndroidRuntime(609): Caused by: java.lang.NullPointerException
05-07 13:22:31.478: E/AndroidRuntime(609): at
newapp.com.MainActivity.onCreate(MainActivity.java:32)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-07 13:22:31.478: E/AndroidRuntime(609): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-07 13:22:31.478: E/AndroidRuntime(609): ... 11 more
05-07 13:22:41.409: I/Process(609): Sending signal. PID: 609 SIG: 9
this is the main activity code
package newapp.com;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.os.Build;
public class MainActivity extends ActionBarActivity {
int counter;
Button add,sub;
TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
counter=0;
add=(Button) findViewById(R.id.badd);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
counter++;
}
});
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
And here is the xml code
<LinearLayout 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"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="newapp.com.MainActivity$PlaceholderFragment" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="The sum is"
android:textSize="45dp"
android:gravity="center"
android:id="@+id/tdisplay"
/>
<Button
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="add"
android:id="@+id/badd"
/>
<Button
android:id="@+id/bsub"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="subtract" />
</LinearLayout>
thank you