mskw
mskw

Reputation: 10318

How come I cannot set a breakpoint inside the Android SDK?

I tried to find the entry point for my app by putting breakpoint at

onCreate

inside Activity.java, but it never breaks at that point. Is this allowed or possible?

Here is where I breakpoint

   protected void onCreate(Bundle savedInstanceState) {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);
        if (mLastNonConfigurationInstances != null) {
            mAllLoaderManagers = mLastNonConfigurationInstances.loaders;
        }
 --breakpoint here--->>>>>>>>          if (mActivityInfo.parentActivityName != null) {
            if (mActionBar == null) {
                mEnableDefaultActionBarUp = true;
            } else {
                mActionBar.setDefaultDisplayHomeAsUpEnabled(true);
            }
        }
        if (savedInstanceState != null) {
            Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
            mFragments.restoreAllState(p, mLastNonConfigurationInstances != null
                    ? mLastNonConfigurationInstances.fragments : null);
        }
        mFragments.dispatchCreate();
        getApplication().dispatchActivityCreated(this, savedInstanceState);
        mCalled = true;
    }

I tried to break at super.onCreate(), which hit, but when I stepped in, it just steps right over everything once inside.

Upvotes: 0

Views: 226

Answers (2)

sun_dare
sun_dare

Reputation: 1166

Here are the steps to do so.

To create a method breakpoint using the Breakpoints dialog
1) On the main menu, choose Run | View Breakpoints, or press Ctrl+Shift+F8.
2) In the Breakpoints dialog box that opens, click add.
3) Select Method Breakpoint from the drop-down list.
4) In the Add Method Breakpoint dialog box, specify the class name pattern, including the package name, and the name of the desired method.
5)So doing, when the debugging session starts, the application will pause in all classes with the names matching the specified pattern, at the specified method.

link would provide you more details

Upvotes: 1

sun_dare
sun_dare

Reputation: 1166

No, you cannot put it on the method declaration statement(which I feel is correct and of no use). You can put the breakpoints inside the function for the code statements.

Upvotes: 1

Related Questions