jublikon
jublikon

Reputation: 3447

Android starts empty activity

I am starting an acitivity the usual way like this:

Intent intent = new Intent(getActivity(), GalleryActivity.class);
                intent.putExtra(PUTEXTRA_IDENTIFIER_MACHINE, selectedMachine);
                startActivity(intent);

Problem: I can stop everywhere I like in my app for debugging. But it is not possible to stop in the GalleryActivity. Even not in the onCreate() method before any mistake could be made by me.

So everything I see is always a pure white page coming up.

How can I make stopping for debug in that activity possible?

It seems like android is not starting the stuff I have implemented but some kind of dummy acitivity. So when I log something in the new activity, for example, nothing happens. Where can that come from ?

registration of that activtiy in AndroidManifest.xml:

 <activity
            android:name="com.mego.smscloud.reviewmaschine.gallery.GalleryActivity"
            android:label="@string/app_name"
            android:parentActivityName="com.mego.smscloud.reviewmaschine.ReviewMaschineActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.mego.smscloud.reviewmaschine.ReviewMaschineActivity" />
        </activity>

activity

public class GalleryActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener{

   (...)

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);

        setContentView(R.layout.activity_gallery_view);
        setTitle(null);

      (...) some init 

    }

    @Override
    public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
        settingsMenu.onSaveInstanceState(outState);
        super.onSaveInstanceState(outState, outPersistentState);
    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    }

    @Override
    public void onPageSelected(int position) {
        CharSequence title = new SpannableBuilder(this)
                .createStyle().setFont(Typeface.DEFAULT_BOLD).apply()
                .append(photoList.get(position).getName()).append("\n")
                .clearStyle()
                .append(photoList.get(position).getDate())
                .build();
        titleView.setText(title);
    }

    @Override
    public void onPageScrollStateChanged(int state) {

    }
}

Note: I have already added

minifyEnabled false

to my gradle file.

What it does look like (I have textviews placed inside the layout):

enter image description here

The logs I get:

07-05 06:42:04.216 25558-25583/com.mego.smscloud W/EGL_emulation: eglSurfaceAttrib not implemented
07-05 06:42:04.216 25558-25583/com.mego.smscloud W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe3097920, error=EGL_SUCCESS
07-05 06:42:05.645 25558-25558/com.mego.smscloud I/Choreographer: Skipped 82 frames!  The application may be doing too much work on its main thread.
07-05 06:42:07.324 25558-25583/com.mego.smscloud W/EGL_emulation: eglSurfaceAttrib not implemented
07-05 06:42:07.324 25558-25583/com.mego.smscloud W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe456a580, error=EGL_SUCCESS
07-05 06:42:12.247 25558-25558/com.mego.smscloud I/Choreographer: Skipped 292 frames!  The application may be doing too much work on its main thread.

Upvotes: 0

Views: 75

Answers (1)

Silwester
Silwester

Reputation: 418

The normal onCreate method should look like

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   // do stuff
}

I think that can be the problem. Docs here

Upvotes: 2

Related Questions