Questions tagged android-fragments

Explore the latest questions and answers asked by our top developers.

Retrieve data from Realtime Database in fragment recyclerview

When I send data to realtime database. it generates 1…5…… numbers as ID with this code: private fun newpost() { var id = 1 buttonPost.setOnClickListener() { dataa.child(auth.currentUser?.uid!!).get().addOnSuccessListener { if (it.exists()) { val imageUrl = it.child("photoUrl").value val postText = editTextNewPost.text.toString() if (postText.isNotEmpty()) { data.child(id.toString()).child("title").setValue(postText) data.child(id.toString()).child("imageUrl").setValue(imageUrl.toString()) editTextNewPost.setText("") id += 1 Toast.makeText(activity, "Post Added", Toast.LENGTH_LONG).show() } } } […]

How to know when a BottomSheetDialogFragment is visible to user?

I am Working on a social media application and facing this issue. I have two BottomSheetDialogFragment, suppose Fragment A and B. NO Viewpager is used here. If I click on a button Fragment A (List of Comments is shown and lifecycle callbacks are called) and by clicking on any comment Fragment B(The chat) is shown. […]

How to automatically update data when parameters are altered in Android Studio

Basically, I made a fragment with a few EditTexts where the user can insert data about himself, such as bodyweight, height, age, etc.. I also added a TextView which displays that person’s basal metabolic rate depending on the data that was inserted, but the problem is, whenever I change the person’s information, it doesn’t automatically […]

By KingSwoozie
Published
Categorized as android, android-fragments, java

I am Fetching data from Api in Fragment using Retrofit in Android. but I run the project the project will crash

I am Fetching data from Api in Fragment using Retrofit in Android. but I run the project the project will crash. Source: Android Questions

By Mudasir Khan
Published
Categorized as android, android-fragments, api, collections, fragment

I am using Searchview in Fragment and my data is not added in my New array Using Kotlin

I am adding Searchview in Fragments and Menuitem is Inflated but when I click on Searchview Button and enter query Nothing Changes and my Data is not added.please help here is the code Answer should be in Kotlin override fun onQueryTextChange(p0: String?): Boolean { temp.clear() //this is my temp array var text=p0?.lowercase(Locale.getDefault()) if (text!!.isNotEmpty()){ makeText(activity […]

By Shivam Verma
Published
Categorized as android, android-fragments, error-handling, kotlin, searchview

using onQueryTextChange in fragment and need some suggestions regarding code

Actually I Wanna add SearchView in fragments Using Kotlin but My Code is Throwing error,here "lowercase" Code says Unresolved Reference ,Receiver type Mismatch(I know what compiler wanna tell me ).Now please tell me Condition that i can put in if Condition. thanks Here is my Code : … temp.clear() //temp array list val searchtext= p0!!.lowercase(Locale.getDefault()) […]

How to change toolbar title with fragment back stack

I have made a very simple application with multiple fragments in one activity. Also, added toolbar. Now 4 fragments have different titles. when I go to fragment 1 the title is Fragment 1 when I go to fragment 2 the title is Fragment 2 now come to the problem…. when I press back from fragment […]

By Andy Jadeja
Published
Categorized as android, android-fragments, fragment

Receive fragment result in Navigation Component Fragment

I have implemented NavHost(Navigation Component) in MainFragment(that contain NavHost) and it has three other fragment in it’s nav (CategoryFragment,GalleryFragment and PreviewFragment) Above three fragment are sibliing in nav_graph. I want to send a model to our parentFragment(MainFragment) I have tried two different ways to send data to parentFragment(MainFragment) PreviewFragment.kt on Button Click parentFragmentManager.setFragmentResult("requestKey", bundleOf("bundleKey" to […]

By Taimoor Khan
Published
Categorized as android, android-fragments, navigation

Android Java: RecyclerView with bindings in Fragments generates a NullPointerException

I am trying to develop a simple application and it seemed ok, but I cannot find a way to add a RecyclerView in Fragments. I tried to follow this Tutorial but I think that something different makes me some problems So, here is my code: ResocontoFragment.Java package com.example.frangela.ui.resoconto; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import […]

Best practice – hiding activity navigation from a fragment

I have a main activity that has navigation that needs to be visible while the device is in portrait. Is it possible (and a best practice) to hide the navigation from a fragment is the device is rotated to landscape? I would also need the navigation to be visible again if the device is rotated […]

By KoolKeith
Published
Categorized as android, android-fragments
1 2 3 573

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq