I am trying to pass information from my alert dialog to my second fragment (I am using tabbed activity layout). I want to pass information from alert dialog to fragment when I click on my ImageView, but my app keep crashing until I implement my interface inside MainActivity.java. My main mission here is to open alert dialog which contains several
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
How can I change the way I display the fragments in differents display sizes?
I’m currently making an app for Android devices and I would like to know how can I change the way I display the fragments in differents display sizes (ex. Tablet). At this point I have an activity for all my fragments and this causes me to replace the fragments when I change page but for tablets I would like to
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
Passing Nullable Values from Activity to Fragment
When passing Strings from an activity to a fragment using I can also pass potential null and receive it in the fragment with I’d also like to pass nullable Floats and Integers but the corresponding putInt() and putFloat() methods don’t allow passing null. I am now passing additional flags as arguments that indicate whether a value is set or not
Starting a new activity on navigation drawer item click
I know this is a question frequently asked, but after reading the many questions and solutions on stack overflow I am confused. I am confused with regards to Fragments and what is required to start an activity from clicking an item in the navigation drawer. I’ve checked these posts but only got confused Q1, Q2 Could someone please explain what
Error in Fragment: “Already managing a GoogleApiClient with id 0”
Everything works right the first time, if you launch a second time you see this error: Here’s my code: As I understand it, the problem is in these lines: I tried explicitly passing an id of 0: but that still didn’t work. What am I missing? Answer You should call stopAutoManage() in the onPause() method of your Fragment:
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: