Posts

Showing posts with the label android-fragments

Option menu with bottomsheetfragment

Image
Clash Royale CLAN TAG #URR8PPP Option menu with bottomsheetfragment i want this type of option Menu . I also created the sheet fragment as below but how can i connect that with option menu Use this library. It will use same menu.xml for loading the bottom sheet. If your requirement is different let me know. I will update the answer. github.com/Kennyc1012/… – Gnanendra Kumar 4 mins ago 1 Answer 1 You can use NavigationView inside the BottomSheet and then add menu to the NavigationView as shown below. Step 1: Add NavigationView to the layout file of the BottomSheet. <com.google.android.material.navigation.NavigationView android:id="@+id/navView" android:layout_width="match_parent" android:layout_height="wrap_conten...

Unreachable statement in onCreateView()

Image
Clash Royale CLAN TAG #URR8PPP Unreachable statement in onCreateView() I am trying to build an app with multiple fragments where all the fragments implement LoaderCallbacks . I've been reading posts on StackOverflow where most of them were pointing out to use import android.support.v4.app stuff. And I did. However, when I try to getLoaderManager from within the onCreateView of the fragment, I am getting an Unreachable statement error. LoaderCallbacks import android.support.v4.app getLoaderManager onCreateView This is one of my Fragments : package com.example.android.morenews; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.List; /** * Created by on 24.12.17. */ public clas...

Fragment trasaction, residue of previous fragment

Image
Clash Royale CLAN TAG #URR8PPP Fragment trasaction, residue of previous fragment I'm new in creating fragments and I have little problem with it. In second activity (in layout) I have widget <fragment ... android:name="path to my first fragment" ... /> I have three fragments to swap. I make it in this way // get fragment manager and fragment transaction FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); // replace fragment on register form transaction.replace(R.id.fragment, new Confirmation()); // commit transaction transaction.commit(); and my fragments layout is wrap in two constraint layout like this <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height=...

How to use EventBus in Adapter and Fragment?

Image
Clash Royale CLAN TAG #URR8PPP How to use EventBus in Adapter and Fragment? In my application i want use EventBUs for manage my event and i want use this into Adapter and Fragment . In my adapter i should call Event . when select one item i want call event . For this i write below code in adapter : EventBUs Adapter Fragment adapter adapter viewHolder.avatarItemList_img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Update image EventBus.getDefault().postSticky(new EventUpdateAvatar()); }); My Fragment codes: @Override public void onStart() { EventBus.getDefault().register(this); super.onStart(); } @Override public void onDestroy() { //unregister event bus EventBus.getDefault().unregister(this); super.onDestroy(); } @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void onUpdate(EventUpdateAvatar ...

Android Fragment Data from 1 activity to list in another fragment

Image
Clash Royale CLAN TAG #URR8PPP Android Fragment Data from 1 activity to list in another fragment Im new to Android.... I have 2 activities 1 is main activity which has 2 fragments left and right... and I have 1 more activity Signup which has some fields in it. i need to submit that form and that details should be saved in a list in the 1st activity left fragment... I have attached the screen shots 1.png is my main activity with 2 fragments left and right. 2.png is signup form 3.png after submitting the form the the left fragment of activity 1 should look like that enter image description here Main Activity:https://drive.google.com/file/d/1OIhWnXnuKmH2D-X-wRVAMXYvEoLIdWNA/view?usp=sharing [Sign Up ][2]:https://drive.google.com/file/d/1ymTjiikgS9_1BIo9nWQHFEPGhKhXS-85/view?usp=sharing [Final design][3]:https://drive.google.com/file/d/1KhW856vqZqYvbfZV78wcsbmNxeVUZPZM/view?usp=sharing By clicking "Post Your Answer...

Sales Force live agent status

Image
Clash Royale CLAN TAG #URR8PPP Sales Force live agent status I have implemented agent live availability according to documentation. Problem is according to documentation it would land in OnResult method but every time response is landed in OnCompleted method, where I am unable to retrieve agent status from async variable. Please Guide me if I am missing something or how to get live agent availability from OnCompleted . My code (called within HomeFragment) private void setupChatButton() { try { // Build a configuration object ChatConfiguration chatConfiguration = new ChatConfiguration.Builder(ORG_ID, BUTTON_ID, DEPLOYMENT_ID, LIVE_AGENT_POD) .build(); // Create an agent availability client AgentAvailabilityClient client = ChatCore.configureAgentAvailability(chatConfiguration); // Check agent availability client.check().onResult((a...

How to Remove Fragment from FragmentPagerAdapter?

Image
Clash Royale CLAN TAG #URR8PPP How to Remove Fragment from FragmentPagerAdapter? I know there are some topics about this here already but I could not find a solution which I could get to work for my case. I have a working sliding gallery using a custom FragmentActivity and FragmentPagerAdapter which holds a list of Fragments. FragmentActivity FragmentPagerAdapter Within the FragmentActivity is a ImageView "delete". If clicked, the function deleteMedia() is called which then should remove the current Fragment and the following Fragment should be displayed. How would I have to do that in my example? FragmentActivity ImageView deleteMedia() Fragment Fragment FragmentActivity: public class GalleryPagerActivity extends FragmentActivity implements OnClickListener { private Intent intent; private SharedPreferences settings; private PagerAdapter mPagerAdapter; private ViewPager mPager; private List<Fragment> fragments; private List<WhiteboardMe...