android-fragmentactivity

ListFragment RuntimeException 'android.R.id.list' missing

早过忘川 提交于 2019-12-08 09:45:09
问题 Edit 1/16/2013: Problem Resolved! Two days ago, I released an updated version of the app and correctly identified the ListViews as I had originally done, by using android:id="@android:id/list . Really though, the exception being thrown was misleading and that had nothing to do with the actual problem... The real fix came when I implemented the suggestions by Sean on inflating the ListFragment views by passing null to the ViewGroup . I have not received the same Exception from the new version,

How to access another activity?

自作多情 提交于 2019-12-08 09:39:23
问题 Just to make it clear, this is not I want. I want to access another Activity's context. Suppose I've two activities, MainActivity and WebActivity . In MainActivity I used oAuth2 login, and after login I start the WebActivity . In WebActivity I need to logout with the function mTencent.logout(MainActivity.this); , the question is how can I access MainActivity from WebActivity ? If I do this directly, I get the error, MainActivity is not an enclosing class? Considering I'm a starter of android,

CustomAnimations on FragmentTransaction not working for the old fragment

坚强是说给别人听的谎言 提交于 2019-12-08 09:37:18
问题 My FragmentActivity displays one Fragment at the beginning and a second when I press a Button . Until here, it's easy. But I got one problem with the animations. I add the second fragment with: mTChild.add(R.id.container, mFragChild).addToBackStack(null).commit(); And to make it more "alive", I declare a CustomAnimations before adding the Fragment , it looks like this: mTChild.setCustomAnimations(R.anim.slide_in, R.anim.alpha_out, R.anim.alpha_in, R.anim.slide_out); mTChild.add(R.id.container

Can a fragment extend a fragment activity? [Android]

▼魔方 西西 提交于 2019-12-08 08:30:24
问题 I have created a MainActivity which consists of 3 tabs which are scrollable (by using ViewPager). Now each of these 3 tabs is a Fragment. Also, I am using ActionBarSherlock (ABS). For the 1st Fragment, I have created the following class: public class Fragment_1 extends SherlockFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.fragment1, container, false)

Using ListActivity in Fragment

懵懂的女人 提交于 2019-12-08 06:32:15
问题 The below code is running the custom listview implemented in a seperate project. public class MainActivity extends ListActivity implements OnTouchListener{ private MyCustomAdapter mAdapter; Activity temp = this; String []s = new String[500]; ArrayList<GS> q = new ArrayList<GS>(); ListView lv; int count=0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DBAdapter db = DBAdapter.getDBAdapter(getApplicationContext()); if (!db.checkDatabase()) { db

How to get the selected Tab of a viewPager?

风流意气都作罢 提交于 2019-12-08 02:06:13
问题 I created a viewpager using the lib viewpagerindicator. The activity extends FragmentActivity, so I have a problem to get which tab is selected. My adapter is given by the code below. class GoogleMusicAdapter extends FragmentPagerAdapter implements IconPagerAdapter { public GoogleMusicAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // add each fragment in the right place if(position == 0){ // return TestFragment.newInstance(CONTENT[(position + 1) %

How do I get the back button to go to a certain Fragment in horizontal scrolling? Exits app right now

谁说胖子不能爱 提交于 2019-12-08 01:06:38
问题 the title pretty much explains it. I have horizontal scrolling set up, the first screen has buttons to the other Fragments as well as the whole horizontal scroll system. What I would like is for the user to be able to press the back button when on one of these fragments and for the app to return to the first screen with all the buttons. From there I want the back button to be an AlertDialog asking the user if they would like to exit the app. At the moment this is what is happening (On all

Refreshing fragments in FragmentActivity after sync service runs

左心房为你撑大大i 提交于 2019-12-07 16:25:12
问题 does anybody have any elegant solution for refreshing the Views in Fragments in a FragmentActivity's ViewPager after a sync Service from a SyncAdapter runs? I've tried calling notifyDataSetChanged() and notifyDataSetInvalidated() on my adapter, as well as refreshDrawableState() on my views ( GridViews ), but to no avail. Perhaps I've been calling them from the wrong places -- I've tried doing it at setUserVisibleHint where isVisible =true, hoping to trigger it whenever the fragment comes into

Android Youtube Player in Fragment and Activity causes black screen

拥有回忆 提交于 2019-12-07 12:29:13
问题 I need to load a video in youtube player in an fragment (Consider it as Fragment A) as a header to a gridview in a fragment.Video is loading fine without any issue. But if i click on a grid item and loads seperate activity (Consider it as Activity B) in which there also, I am having youtube video player. It is playing fine in that activity. But when i come back to fragment from the activity B , now youtube player is not playing. Simply black screen is displaying. FYI, I am having Fragment A

Fragment is recreate on back press from other Fragment

亡梦爱人 提交于 2019-12-07 07:28:51
问题 I am facing a problem in regarding fragment. In my scenario, There are two fragment associated with FragmentActivity. In FragmentActivity, there are a container layout (Frame Layout) in which all fragment will replace. public void replaceFragment(Fragment fragmentClass) { String selectedFragment = fragmentClass.getClass().getName(); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction(); fragmentTransaction