android-fragments

How to get access to getSupportFragmentManager or SupportFragmentManager in fragment

天大地大妈咪最大 提交于 2020-06-12 02:16:58
问题 The name 'getSupportFragmentManager' does not exist in the current context My Code: using Android.Views; using Android.OS; using Android.Support.V4.App; using com.refractored; using Android.Support.V4.View; namespace XamarinStore { public class HomeFragment : Android.App.Fragment { BadgeDrawable basketBadge; int badgeCount; public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RetainInstance = true; SetHasOptionsMenu(true); // Create your fragment here

How to get access to getSupportFragmentManager or SupportFragmentManager in fragment

谁都会走 提交于 2020-06-12 02:16:49
问题 The name 'getSupportFragmentManager' does not exist in the current context My Code: using Android.Views; using Android.OS; using Android.Support.V4.App; using com.refractored; using Android.Support.V4.View; namespace XamarinStore { public class HomeFragment : Android.App.Fragment { BadgeDrawable basketBadge; int badgeCount; public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RetainInstance = true; SetHasOptionsMenu(true); // Create your fragment here

How to get access to getSupportFragmentManager or SupportFragmentManager in fragment

给你一囗甜甜゛ 提交于 2020-06-12 02:16:15
问题 The name 'getSupportFragmentManager' does not exist in the current context My Code: using Android.Views; using Android.OS; using Android.Support.V4.App; using com.refractored; using Android.Support.V4.View; namespace XamarinStore { public class HomeFragment : Android.App.Fragment { BadgeDrawable basketBadge; int badgeCount; public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RetainInstance = true; SetHasOptionsMenu(true); // Create your fragment here

How to get access to getSupportFragmentManager or SupportFragmentManager in fragment

折月煮酒 提交于 2020-06-12 02:13:50
问题 The name 'getSupportFragmentManager' does not exist in the current context My Code: using Android.Views; using Android.OS; using Android.Support.V4.App; using com.refractored; using Android.Support.V4.View; namespace XamarinStore { public class HomeFragment : Android.App.Fragment { BadgeDrawable basketBadge; int badgeCount; public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RetainInstance = true; SetHasOptionsMenu(true); // Create your fragment here

Android set transparent background for a fragment

旧城冷巷雨未停 提交于 2020-06-11 16:53:06
问题 In my app I have single activity and and all other fragments I am setting background for activity from style.xml as below <item name="android:windowBackground">@color/very_light_gray</item> Now for only a perticular Fragment I want to set background transparent and I am not able to do that tried below code in Fragment did not work for me @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // create ContextThemeWrapper from the original

Keeping a reference to a View in a Fragment causes memory leaks?

强颜欢笑 提交于 2020-06-10 03:55:12
问题 Somebody told me the following, but I am a bit perplexed. Please, would you be able to confirm or dispute it? (the Fragment is not retained via setRetainInstance() At the moment it is a common practice to initialize views in Fragments like this: private lateinit var myTextView: TextView fun onViewCreated(view: View, bundle: Bundle) { ... myTextView = view.findViewById(R.id.myTextViewId) ... } And then we never nullify this property. Though this is a common practise, it is causing a memory

List All Mp3 files in android

瘦欲@ 提交于 2020-06-09 10:57:28
问题 I am developing music player in android but stuck in reading MP3 files. here is my code to read all mp3 files. but its not returing any files from device(although there are some files which i copied using adb). I also want it to list using Album, artist etc. please help in this. final String MEDIA_PATH = Environment.getExternalStorageDirectory()+""; private ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); // Constructor public SongsManager(){ } /** *

List All Mp3 files in android

一笑奈何 提交于 2020-06-09 10:56:26
问题 I am developing music player in android but stuck in reading MP3 files. here is my code to read all mp3 files. but its not returing any files from device(although there are some files which i copied using adb). I also want it to list using Album, artist etc. please help in this. final String MEDIA_PATH = Environment.getExternalStorageDirectory()+""; private ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); // Constructor public SongsManager(){ } /** *

Fragment editText data getting cleared when i am moving to another activity and coming back in Quiz app

…衆ロ難τιáo~ 提交于 2020-06-09 05:32:48
问题 I have an android quiz app source code. In which options are in checkbox type. But for some questions, I need to make as edittext answer. How to convert the input type from checkbox to edittext. I will attach the images explaining the requirement. I am giving the GitHub link below Source Code of the Quiz App: https://github.com/tendentious/Multiple-Choice-Questions-Android-App XML files: https://github.com/tendentious/Multiple-Choice-Questions-Android-App/tree/master/app/src/main/res/layout

Can an Activity access a Fragment to know if a button has been pressed?

淺唱寂寞╮ 提交于 2020-06-09 04:20:07
问题 The Objective: I'm trying to make a notepad application. What my app does is, a button is pressed to create a new note. This pops up a fragment in which the user types his note. Within the same fragment, I have another button that signifies when the user is done typing. Question 1: Is there a way by which pressing the other button in the Fragment could trigger a method in my Activity? Question 2: Would this cause the app to become too bloated? Should I keep the button within my activity