fragment

how to pass value from NavigationDrawerFragment.java to MainActivity.java then pass to AnotherFragment page

女生的网名这么多〃 提交于 2019-12-13 02:46:48
问题 in my NavigationDrawerFragment.java i have this code expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { String header = listDataHeader.get(groupPosition); Category child = listDataChild.get(header).get(childPosition); // child.name to get the name // child.id to get the id //Toast.makeText(getActivity(),"ChildNme: "+child.name+" ChildId: "

Adding Map to Android TAB - Error

安稳与你 提交于 2019-12-13 02:46:39
问题 I have created an application where I have 3 tabs and in the last one I have added a map, and here is the error because I get an error navigating with the tabs. Take a look below the code Tab fragment: public class Tab3 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.tab_3, container, false); return v; } } xml: <?xml version="1.0" encoding="utf-8"?>

Android Java: Fragments returning null view in onCreateView()

我们两清 提交于 2019-12-13 02:40:08
问题 I am currently working on a program that uses an MVC design pattern and fragments in android java. I have figured out one of my fragments and gotten it working but when I copied the other fragments to follow the same code structure (with specialized functionality), I get a null pointer exception in the onCreateView method. I'm on my junk laptop right now and it can't seem to handle android emulation so I can post the exact error code tomorrow. I have my source code though and I have been

Android Fragment Lifecycle of Single Instance Activity

馋奶兔 提交于 2019-12-13 02:37:47
问题 I have a singleInstance Activity and a Fragment which I instantiate in the onCreate() method and add into a FrameLayout container into the layout of the activity. The activity does nothing except printing out the logs. I am using the android-support-v4 lib and android 2.3.3. I observed a strange lifecycle behavior with this setting and I wonder if you might help me to explain this. I will provide the logs for the lifecycles: First call of the activity: 07-07 15:12:17.990 V/FragActivity( 2358)

ListView not populating, or WebView taking up entire screen?

时光毁灭记忆、已成空白 提交于 2019-12-13 01:22:29
问题 I have code that should populate my ListView in my UrlListFragment, but when I run it I see no effect. I put the problem aside to work on my WebView, and found that once I load a URL it uses the entire screen. I'm not sure if this means my ListView isn't being populated, so it doesn't take up space, so the WebView takes up the entire screen, or if the WebView is taking up the entire screen regardless of whether the ListView is being populated or not. I populate my ListView like this: View

Android layout using Swipe View and Tile Strip

谁说胖子不能爱 提交于 2019-12-13 01:17:45
问题 I'm making a new app, using the "Swipe View + Tile Strip" layout, but can't seem to figure out how to actually load different views into the fragments of the FragmentPagerAdapter? Any help on this would be great (I'm still quite new to android development, so go easy ;) ) 回答1: Create a class that extends FragmentPagerAdapter . Override getItem() and return a different fragment for each position. Try something like this: public class MyCustomFPAdapter extends FragmentPagerAdapter{ public

Fragment Orientation Change - Better Test than for Landscape

早过忘川 提交于 2019-12-13 01:15:28
问题 In 'Landscape' mode I have two FrameLayouts controlled by One Activity and utilizing two Fragments. In 'Portrait' mode I have one FrameLayout controlled by One Activity, on Selecting a Line I call another activity to display the detail using a detail fragment In the 'Portrait' detail activity I have the following check for orientation in the onCreate() method. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { finish(); return; } The above works well

Android Swipe Fragment on click

主宰稳场 提交于 2019-12-13 00:55:37
问题 I have a Fragment pager, I built a button on the first fragment. Now I want to make it swipe to the second fragment when I click on that button. I built this so far: public class HowTo extends Fragment { @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View android = inflater.inflate(R.layout.how_to, container, false); ((TextView) android.findViewById(R.id.howTo)).setText("howto

Android app closes when back button pressed

南楼画角 提交于 2019-12-13 00:14:08
问题 I have the following activity which launches a fragment when the tab is selected: public class MainActivity extends Activity implements TabListener { Fragment f = null; ..... public void onTabSelected(Tab tab, FragmentTransaction ft) { ..... if (tab.getPosition() == 0) { if (initalSync == true) { progress1.setVisibility(TRIM_MEMORY_UI_HIDDEN); } f = new EventFragment(); Bundle data = new Bundle(); data.putInt("idx", tab.getPosition()); f.setArguments(data); } if (tab.getPosition() == 1) {

Why Fragment crashes on .hide() with .setCustomAnimations()?

时间秒杀一切 提交于 2019-12-13 00:09:05
问题 xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment android:id="@+id/the_fragment" android:name="com.example.MyFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" tools:layout="@layout/fragment_my"/> <Button android