fragment

Xamarin ZXing QR Code inside tab

谁说我不能喝 提交于 2019-12-12 19:55:21
问题 I would like to integrate ZXing QR code scanner into my app. I am using Fragment for my tabs. For example in Tab2, how I can add a window to show the scanner view? I tried to use CustomOverlay with view but unfortunately it did not work. I also tried to use ZXingScannerFragment,but it requires Android.Support.V4.App which is not ideal as all my other two tabs uses Android.App namespace. Where I am at right now is that, when Tab 2 is selected, it jumps straight to the scanner, and the Action

Fragment - replace container, if id is not unique

本秂侑毒 提交于 2019-12-12 18:28:48
问题 I have a layout that has two views with the same id. If I want to find the view I just call parentView1.findViewById(R.id.content) or parentView2.findViewById(R.id.content) to get the correct view. If I want to replace a container with a fragment, can I somehow define which one I want to be replaced? 回答1: Fragment manager accepts only id, so, i think, answer is no, you cannot specify container. But you still can found both of them. As a workaround you can wrap your containers with fragments

Error Android Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'

风流意气都作罢 提交于 2019-12-12 17:50:27
问题 I have a fragment with button, on click the button should change the theme in my app but when i open the class i simply get this error: This is the logcat 08-14 21:32:45.914 29624-29624/addid E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: appid, PID: 29624 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at appid.Fragment.GuidaTv.InitView(GuidaTv.java:75) at appid

Use Observer in Fragment

五迷三道 提交于 2019-12-12 16:09:48
问题 I've a problem when using an observer in a fragment, I've implemented my own TextViewObserver, and I wan't to insert it in a Fragment: public class TextViewObserver extends TextView implements Observer { public TextViewObserver(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public TextViewObserver(Context context, AttributeSet attrs) { super(context, attrs); } public TextViewObserver(Context context) { super(context); } @Override public void update

Android ShowDialog : IllegalStateException: Can not perform this action after onSaveInstanceState

[亡魂溺海] 提交于 2019-12-12 16:09:11
问题 In runOnUiThread() of an Activity, I'm trying to show a ProgressDialog. FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); ProgressDialogFragment mProgressDialogFragment = new ProgressDialogFragment(); mProgressDialogFragment.show(fragmentTransaction, TAG); Here ProgressDialogFragment extends DialogFragment . I have tested this in many devices and didn't get any crash. But whereas in Asus, I'm constantly getting the below crash whenever I show the dialog

Communication between ViewPager and current Fragment

爱⌒轻易说出口 提交于 2019-12-12 12:57:32
问题 I'm using a ViewPager ( http://developer.android.com/reference/android/support/v4/view/ViewPager.html ) with some images in Fragments, and because I want to support zooming I am extending ViewPager and overriding: onInterceptTouchEvent The next step is to determine whether or not the image is zoomed in. If it is zoomed in I'll let it handle the event, otherwise I'll pass the event to super. My main problem, and the heart of my question, is determining the best and most efficient way to

Fragment onResume() and backStack issue

社会主义新天地 提交于 2019-12-12 11:53:10
问题 I am stuck with situation for resuming my fragment when I am coming back from another fragment. Scenario : I have a Fragment A . Now I am opening multiple fragment with in Fragment A say : A1, A2, A3 ... using a frame layout. Now I am initiating a new Fragment say Fragment B from one of A1/A2/A3 ... I am performing some action over Fragment B and now when I Pop Out my Fragment B then I am not able to get onResume() of Fragment A Just need to get onResume() while I get back from Fragment B Any

Working with OptionsMenu in nested fragment

故事扮演 提交于 2019-12-12 10:56:13
问题 I use a NavigationDrawer pattern that is implemented in my hostactivity MenuActivity . My navigation has 3 items: Item 1, Item 2, Item 3. Each itemis bonded to a fragment. When I click on Item 1, I displayed a fragment A that implements a ViewPager with several fragments (nested fragments). In my nested fragments, I inflate a menu with the following method (It works fine !) : @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.my_menu, menu);

Error inflating class fragment with SupportMapFragment

假装没事ソ 提交于 2019-12-12 09:23:53
问题 Here is yet another “Error inflating class fragment with SupportMapFragment” issue. Here is my fragment XML: <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" class="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.myapp.maptest.MapsActivity" /> Here is my activity (it is started from a NavigationDrawer in the main

Iappcompat v21: material design ActionBar() InflateException error-inflating-class

倖福魔咒の 提交于 2019-12-12 09:21:25
问题 Trying to move app made in ( appcompat v20 ) to the new library appcompat v21 with: appcompat-v7:20 work nice I did this: ActionBarActivity implements ActionBar.TabListener, ActionBar.OnNavigationListener and have this: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.internal.widget.ActionBarOverlayLayout Error inflating class android.support.v7.internal.widget.ActionBarView 回答1: In order to use the new appcompat v21 you have to: extend the