android-fragments

Fragment onListItemClick

非 Y 不嫁゛ 提交于 2021-02-10 03:25:07
问题 My onListItemClick is never call when i click on item, the class is extends fragment not listfragment, because i have other view items in this fragment which is not list, so how to implement onlistitemclick in class extends fragment? class public class MainFiles extends Fragment { ArrayList<String> items; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.files, container, false); Button button_up = (Button

Fragment onListItemClick

你说的曾经没有我的故事 提交于 2021-02-10 03:24:12
问题 My onListItemClick is never call when i click on item, the class is extends fragment not listfragment, because i have other view items in this fragment which is not list, so how to implement onlistitemclick in class extends fragment? class public class MainFiles extends Fragment { ArrayList<String> items; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.files, container, false); Button button_up = (Button

Fragment onListItemClick

耗尽温柔 提交于 2021-02-10 03:21:26
问题 My onListItemClick is never call when i click on item, the class is extends fragment not listfragment, because i have other view items in this fragment which is not list, so how to implement onlistitemclick in class extends fragment? class public class MainFiles extends Fragment { ArrayList<String> items; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.files, container, false); Button button_up = (Button

Android - EditText made programmatically not showing keyboard

岁酱吖の 提交于 2021-02-09 20:23:07
问题 I am making an app where I am using a ArrayAdapter<String> and I am programmatically making an editText view inside of a Relative Layout which is all inside of a AppCompatDialogFragment . Each of the editTexts are showing up and I can click on them, but if it doesn't open the keyboard to type. I have tried things like: EditText editText = (EditText) findViewById(R.id.myTextViewId); editText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD

How do I show the previously selected date in a DatePickerDialog on next call?

三世轮回 提交于 2021-02-08 15:07:38
问题 A DatePickerDialog is loaded in a Fragment with today's showing as the default date when the dialog is first opened. The user then selects a date and then the dialog is dismissed. On next re-open, how do I show the previously selected date as the default date rather than it showing today's date? I have tried .set() in the Activity but don't know how to use .get() to retrieve the date in the fragment. I've tried an interface with a listener between the Activity and the fragement but could not

How to extend both fragment and AppCompatActivity to a same class?

随声附和 提交于 2021-02-08 12:13:45
问题 I have a class.I have extended Fragment to this class because I used fragments when developing Navigation Drawer. The code is below public class aboutSLFragment extends Fragment { public aboutSLFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_about_sl, container, false); } @Override public void

Displaying RSS Feed on a fragment [duplicate]

霸气de小男生 提交于 2021-02-08 12:01:22
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 2 years ago . I've created an app with a drawer menu that opens a new fragment for each menu option. Within those fragments i'm attempting run several functions. I've parsed an RSS feed, and want to display the information I've parsed on a ListView inside a specific fragment. My main activity navigates to the fragment no problem but gets stuck with a Null Pointer exception. This

ViewPager findViewById is null after screen rotation in android

风格不统一 提交于 2021-02-08 10:17:30
问题 I'm using a viewPager to display some forms. My problem is when i rotate the screen of the device and the viewPager is created again, it doesn't see the viewPager when he reaches the findViewById , it's always null . I have no idea how to handle it when rotation change. I tried the onConfigurationChange but it doesn't work, I tried to save the Id of the pager and then retrieve it using that saved id but nothing too. So I'm quite blocked now. pager = (CustomViewPager) getActivity()

How to update UI from a Runnable?

99封情书 提交于 2021-02-08 09:16:31
问题 I need to update ui from runnable. My logic goes like below. I start the runnable from onCreate of the fragment lifecycle. And the runnable instance is responsible to request network. The problem is I don`t know how to update the fragment after runnable instance fetched the data from network. code to start runnable in fragment in CustomFragment.java. public void onCreate(Bundle savedInstanceState) { Log.d(DEBUG_TAG, "onCreate"); super.onCreate(savedInstanceState); accountMgr

How to save selected tab when rotating screen/changing tab on Xamarin.Android?

混江龙づ霸主 提交于 2021-02-08 08:45:26
问题 I'm using Xamarin Studio and developing a small test project for Android. I have an Activity with three Tabs on it, each Tab have a different Fragment . So far I got the hang of how to add Tabs and event handlers. But when I rotate the screen, the default Tab I set is selected which causes the Fragment assigned to that Tab to be displayed. Another problem I face is that when I change Tabs , I want to preserve the state of the previous Tab , so when I select it again it won't be rendered again