Skip to content
Advertisement

Tag: android-fragments

Cannot find symbol error in android studio

I’m trying to add fragments to a navigation drawer. But I have the error: cannot find symbol class Fragment. I added: import android.support.v4.app.Fragment Also add the fragment object(Fragment fragment) Where is the mistake? What should I do? Home.java build.grandle I’ve tried to search the web and forums but so far I didn’t find anything helpful. Thank You so much. Answer

NavigationView header image

I need to change NavigationView header image from fragment, but i am getting error. Someone can tell me what i am doing wrong?. Thank you for helping))) java.lang.NullPointerException: Attempt to invoke virtual method ‘android.view.View android.support.design.widget.NavigationView.getHeaderView(int)’ on a null object reference My Fragment code navigation header xml activity_main Answer The view you are referring here is your fragment which is not

Android Fragment OnAttach method

I’m new to Android development and have a question about OnAttach(Context context) method. As far as I understand you override OnAttach method in the class that you extend Fragment and what it basically does is it attaches the fragment to the Activity(Context) that gets passed as a parameter. However, in a lot of example codes I’ve seen on the internet,

Fragment class not found

I’ve just started working on my first Android app and my focus is the main activity of the app, MathleteIDActivity, which includes a fragment TextFragment which displays some text. The project builds fine, but crashes as soon as the app is launched. This happens on two different phones running Android 4.x.x, so fragment support shouldn’t be the issue. The stacktrace

Fullscreen DialogFragment overlaps with StatusBar

I created a full screen dialog with the official Guide The problem is, that my Toolbar overlaps with the status bar and I cannot figure out how to solve this. DialogFragment Layout Toolbar Activity creating Dialog EDIT After removing StatusBarTransparency from v21-styles it looks like this Answer The problem is in the transaction.add(containerId, fragment) part. You have it set to:

Advertisement