fragment

Programmatically adding fragment to framelayout in android

烂漫一生 提交于 2019-12-22 01:26:37
问题 I am trying to build a UI combining both static and dynamic elements. For this, I have divided my activity into fragments - all app navigation is then done by replacing fragments instead of navigating between activities. In my main activity layout, I am using a FrameLayout : <FrameLayout android:id="@+id/mainframe" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_below="@id/topsection" android:layout_above="@id/lowersection" /> I have a fragment declared

How to get values from grid view

血红的双手。 提交于 2019-12-22 01:20:15
问题 I have a gridview with editTexts as the individual views in it. I want to save the values that are in each of the editTexts because they are dissapearing when I switch to another fragment or press the home button, so how do I do that? Would I need an array or arraylist that holds all of the views? How would I get the views if I did that? fragment_score_red.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

Pass data between fragments

可紊 提交于 2019-12-22 00:48:15
问题 I have one MainActivity and two fragments. In FragmentA I have a recycler view. If I click on "add" button there, the FragmentB is open. The thing I would like to is to write text into some EditTexts and send data back to FragmentA (and render that data in the recycler view). Could you suggest me something please? Thanks FragmentB public class NewContactFragment extends Fragment { EditText name, number, email; public String mName; public String mNumber; public String mEmail; boolean

White screen in view pager fragment state pager adapter when we come back?

孤街醉人 提交于 2019-12-21 23:15:03
问题 I have used view pager for load fragments using FragmentStatePagerAdapter. when i will come first time it will working but if i am redirect to other fragment from pager adapter and come back it will display blank screen. **fragment_community.xml** <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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="match_parent" android

fragment popbackstack behaviour broken in 25.1.0 and 25.1.1

耗尽温柔 提交于 2019-12-21 21:26:25
问题 Since support version 25.1.0 and the most recent 25.1.1 I got strange behaviour with fragment replacing/adding. There have been issues reported for 25.1.0 Android - fragmentTransaction.replace() not works on support library 25.1.0 But now in 25.1.1 i got similar issues. To reproduce the behaviour i created sample app which you can find at https://github.com/holoduke/fragmenttest It is basically one Activity with a fragment container. A couple of fragments are available which will be

Android ListFragment is to confusing

家住魔仙堡 提交于 2019-12-21 20:47:49
问题 I'm so confused using ListFragment... I cant understand where is the problem... Here is my FragmentActivity class: import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class menu extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.root_menu); if (getSupportFragmentManager().findFragmentById(android.R.id.content) == null) { ListFrag list = new ListFrag();

Button Click inside Fragment to open up new fragment

五迷三道 提交于 2019-12-21 20:24:24
问题 I don't know how to open up a new fragment on button click, I only know how to open new Activity using intent but when I try to open up new fragment my project app crashes hope someone can help me with my problem this is what I have: import android.app.Fragment; import android.os.Bundle; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter;

Fragment, Volley and RecyclerView

我是研究僧i 提交于 2019-12-21 17:57:52
问题 I hope someone out there can help me solve my problem. I have android app that have 3 tabs, i use fragment, first tab is recyclerView list, second tabs is map. the problem is in tabs 1, i need to fetch data with volley to recyclerView on tabs 1, if run fine but i cannot see the data on first app start, but when i change tab and back to tab 1 again it will refresh the data and show the data on recyclerView. Adapter.java public class CustomListAdapterWarkop extends RecyclerView.Adapter

How to: gridview inside a fragment?

∥☆過路亽.° 提交于 2019-12-21 16:58:37
问题 I want to create a gridview like android market, I want to populate this with images from a database on internet. it need to work with androidv4.support, since I want to run 2.2 until 4.0. Someone said, that isnt possible to create a gridview in pre-4.0, is it true? However It only works when I put use setListAdapter() , but it shows only one image per line, like a listview, when I change to gridview.setAdapter() , it doenst work anymore. Here is my try: This is the ListFragment class: public

How to Disable drawer in fragment and back back to correct fragment

拜拜、爱过 提交于 2019-12-21 12:43:28
问题 I have a main Activity with a Fragment layout. The drawer has 3 option: Fragment[1], Fragment[2], Fragment[3]. Inside Fragment[2] and Fragment[3] is one button. This button open other fragment. Fragment[4]. I want Fragment[4] without drawer but with a back button. This is the onClick code in Fragment[2] Fragment fragment = new InstalacionesEncontradasFragment(); Bundle bundle = new Bundle(); bundle.putSerializable("key", this.instalacionesConCategorias); fragment.setArguments(bundle);