android-viewpager

Adding Integers from Different Fragments in a ViewPager

廉价感情. 提交于 2019-12-24 08:56:43
问题 I have a MainActivity that has a ViewPager with 3 fragments ( FragA , FragB , FragC) In FragA, I declared an int a = 10; In FragB, I declared an int b = 20; In FragC, I have a TextView and a Button Now, all I want to do is that when I click the Button on the FragC, it will add the int a and int b from FragA and FragB and the sum will display on the TextView of the FragC Here's my current code: MainActivity.java public class MainActivity extends FragmentActivity { ViewPager viewPager = null;

Updating the ListView in a Fragment from a Dialog in FragmentActivity(using a ViewPager)

风格不统一 提交于 2019-12-24 08:56:23
问题 I have a FragmentActivity (main) which creates 3 Fragments and also a menu. Pretty straight forward, and from the examples in the Android SDK. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dbh = new DBHelper(this); // Create the adapter that will return a fragment for each of the // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up

How to import ViewPagerIndicator library in Eclipse

我的梦境 提交于 2019-12-24 08:02:10
问题 I referred this Link. As they mentioned, I download it as a zip file and tried to import the library project into Eclipse, but I can't. Instead I get a message "No files to import". How to overcome this? 回答1: Normally the problem is that you have an existing project called "library" in your workspace, you need to rename it and try to "import from existing code" again. Another option is In the project root directory, run mvn eclipse:clean Then run mvn eclipse:eclipse to build .classpath and

ViewPager with fragments doesn't draw pages after initial drawing (2) - bridge to react-native

泄露秘密 提交于 2019-12-24 07:26:01
问题 I am using react-native and for layout purposes, unfortunately, I am forced to bridge to some native android code. The problem I am facing is that the ViewPager only displays the first 2 pages (fragments). If I swipe to the third, it's empty. If I go back to the first it's not there anymore and finally, getting to the fourth and nothing is visible anymore. This is of course as a result of only the first 2 fragments actually being drawn that are actually drawn/visible). Also, the fragment

Reload fragment if current tab is clicked again?

谁都会走 提交于 2019-12-24 06:29:21
问题 To navigate in my Android application I use ActionBar.NAVIGATION_MODE_TABS . The content in one of the tabs is changing quite fast. A user should be able to reload the tab by touching the same item in the action bar again. Currently the tab content is cached by ViewPager and therefore not refreshed if a user clicks on the tab. As TabListener.onTabReselected(...) is fired even if the current tab is already shown, it may be the starting point of a solution. 回答1: As TabListener.onTabReselected(.

Reload fragment if current tab is clicked again?

霸气de小男生 提交于 2019-12-24 06:28:35
问题 To navigate in my Android application I use ActionBar.NAVIGATION_MODE_TABS . The content in one of the tabs is changing quite fast. A user should be able to reload the tab by touching the same item in the action bar again. Currently the tab content is cached by ViewPager and therefore not refreshed if a user clicks on the tab. As TabListener.onTabReselected(...) is fired even if the current tab is already shown, it may be the starting point of a solution. 回答1: As TabListener.onTabReselected(.

Android ViewPager swipe like notebook page change

孤者浪人 提交于 2019-12-24 05:38:20
问题 I want to add notebook type ViewPager to swipe like notebook page. I know about simple ViewPager . So how can i=I do that? Can I use animation for that or any library available? 回答1: You need to implement Flip Effect as in a Notebook.. The following three open source libraries will help : JazzyViewPager : https://github.com/jfeinstein10/JazzyViewPager CardFlipAnimation : https://github.com/balesz/android-tutorial-CardFlipAnimation Android Page Curl : https://github.com/MysticTreeGames/android

Android ViewPager Inside Fragment Loaded Only Once

£可爱£侵袭症+ 提交于 2019-12-24 05:37:04
问题 I am getting issue with ViewPager. I am using FragmentActivity and I added the multiple fragment inside FragmentActivity as following method. public void addFragment(Fragment fragment, boolean addToBackStack, int transition) { FragmentTransaction ft = getFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_up,R.anim.slide_down,R.anim.slide_up,R.anim.slide_down); ft.replace(R.id.main, fragment); ft.setTransition(transition); if (addToBackStack) ft.addToBackStack(null); ft

Add multiple images and text to each ViewPager slide

自作多情 提交于 2019-12-24 05:33:32
问题 I have a ViewPager with 3 slides. On each slide I want to be able to add 3 images and a couple different text labels. The code I currently have allows me to add a single image to each slide. I'm confused on how to get this work with multiple images and text for each slide. Any help would be appreciated. public class ImageAdapter extends PagerAdapter { private final Context context; private final int[] GalImages = new int[] { R.drawable.workout_widget_master, R.drawable.workout_widget_master,

ViewPager swipe previous sound

安稳与你 提交于 2019-12-24 04:20:44
问题 Here i am using viewpager to swipe my images & it plays different sound on each image swipe. Now Its working fine but when i swipe back the sound does not match the image... My code:- imagepageradapter package com.android.learning_numbers; public class ImagePagerAdapter { } Main Activity package com.android.learning_numbers; import android.media.MediaPlayer; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.support.v4.view.PagerAdapter;