fragment

Viewpageindicator inside fragment

天涯浪子 提交于 2019-12-17 17:46:13
问题 With a SherlockActionBar i've created a nice interface. In landscape mode you see both listfragment and "detailsfragment". Now I would like to a add a viewpageindicator (https://github.com/JakeWharton/Android-ViewPagerIndicator) inside the detailsframe, so i would look like this: --------------------------| |_1___|TAB1 | TAB2 | ETC | |_2___|-------------------| |_3___|Example: content | |_4___| TAB1 of listitem 1| |_5___|___________________| I hope this is clear. So basicly I would a

Android google map

六眼飞鱼酱① 提交于 2019-12-17 16:53:46
问题 I am try to add Google MAP Api v2 in my application.but I am getting exception. Exception is java.lang.RuntimeException: Unable to start activity ComponentInfo{info.androidhive.googlemapsv2/info.androidhive.googlemapsv2.MainActivity}: android.view.InflateException: Binary XML file line #5: Error inflating class fragment Here is my xml class <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"

Why FragmentManager's getBackStackEntryCount() return zero?

折月煮酒 提交于 2019-12-17 16:34:14
问题 private static void changeFragment(Fragment f, boolean init) { FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.info_content, f,f.getClass().getName()); if(!init){ ft.addToBackStack(null); } ft.commit(); } when I want to get the stack cout by call fm.getBackStackEntryCount(), it returns zero? 回答1: You have to call a fm.executePendingTransactions() after ft.commit() or before fm.getBackStackEntryCount() . Because the commit() only schedules the transactions for a later pass. 回答2

Add Items to ListView - Android

末鹿安然 提交于 2019-12-17 15:49:10
问题 This is my first experience with android. I'm trying to add items to my ListView. I use Tabs, and the only way to see that the item was added is to change tab and then come back to the first tab. I searched around, and I've always found adapter.notifyDataSetChanged(); but doesn't work for me. I have created the project with, as I said, Fixed Tabs + Swipe. I simply want to have listviews which rows have an EditText, a Spinner and a Button. On the bottom of the Fragment used for the tab, I have

Fragment - InstantiationException: no empty Constructor -> Google Maps v2?

末鹿安然 提交于 2019-12-17 10:52:22
问题 I get this error message, when I open a closed App again via App-Change button: Caused by: java.lang.InstantiationException: can't instantiate class com.*.FragmentContact$1; no empty constructor I've found several tips about Inner-Classes and to make them static etc. But this FragmentContact is a public class in a *.java-file and has a public empty constructor . I'm using Google Maps Api v2 in this project and do a trick somewhere from the internet to setup my MapView. Look here: @Override

Fragment - InstantiationException: no empty Constructor -> Google Maps v2?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 10:51:44
问题 I get this error message, when I open a closed App again via App-Change button: Caused by: java.lang.InstantiationException: can't instantiate class com.*.FragmentContact$1; no empty constructor I've found several tips about Inner-Classes and to make them static etc. But this FragmentContact is a public class in a *.java-file and has a public empty constructor . I'm using Google Maps Api v2 in this project and do a trick somewhere from the internet to setup my MapView. Look here: @Override

Why is a FrameLayout used for fragments?

荒凉一梦 提交于 2019-12-17 10:44:17
问题 Wherever I look, FrameLayout seems to be used as the FragmentContainer . Why is FrameLayout always seen with Fragments ? 回答1: You can basically use RelativeLayout or LinearLayout it will still work,but the answer of your question is in FrameLayout 's documentation : FrameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable

App crash after activity has been killed in background

梦想与她 提交于 2019-12-17 09:57:30
问题 i have an issue with an app that use ViewPager for display fragment. All works fine until the app goes in background and be killed from OS. It seems that after restore i have 2 IncidentScreenFragment that handle events, one with a null presenter (MVP) that crash my app. My HomeActivity looks like: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) presenter.onViewCreated() initViews(savedInstanceState) } private fun

Angular2 How to navigate to certain section of the page identified with an id attribute

不羁的心 提交于 2019-12-17 06:53:11
问题 How to navigate to certain section of the page identified with an id attribute? Example: I need to navigate to "structure" paragraph on my page <div id="info"> <h3>Info</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> <div id="structure"> <h3>Structure</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> And I have a following navigation structure: <li> <ul materialize="collapsible" class="collapsible" data-collapsible="accordion"> <li><a

reusing fragments in a fragmentpageradapter

杀马特。学长 韩版系。学妹 提交于 2019-12-17 05:36:11
问题 I have a viewpager that pages through fragments. My FragmentPagerAdapter subclass creates a new fragment in the getItem method which seems wasteful. Is there a FragmentPagerAdapter equivalent to the convertView in the listAdapter that will enable me to reuse fragments that have already been created? My code is below. public class ProfilePagerAdapter extends FragmentPagerAdapter { ArrayList<Profile> mProfiles = new ArrayList<Profile>(); public ProfilePagerAdapter(FragmentManager fm) { super(fm