android-fragmentactivity

Getting exception as Failure saving state: active Fragment has cleared index: -1 when I am pressing home button of android device

怎甘沉沦 提交于 2019-12-07 06:44:55
问题 I am facing some weird issue while I am pressing home button of android and while starting new activity. My stacktrace is as follows 05-13 18:06:21.182: E/FragmentManager(5674): Failure saving state: active Fragment{411d96d8} has cleared index: -1 05-13 18:06:21.182: E/FragmentManager(5674): Activity state: 05-13 18:06:22.032: E/ACRA(5674): ACRA caught a IllegalStateException exception for com.itgurussoftware.android.dineback. Building report. 05-13 18:06:27.732: E/ACRA(5674): com

Nested fragment with wrong activity reference after configuration change

久未见 提交于 2019-12-07 05:41:27
问题 I'm finally looking into the new nested fragments APIs in the support library revision 11. Everything It worked pretty well till I tried to use the activity reference held by the nested fragments. After a configuration change the childFragment doesn't seem to get detached and re-attached to the new activity. Basically after an orientation change my childFragment is in an inconsistent state from which I can't get the correct activity instance with getActivity(). I manged to get the correct one

Hiding app title bar in Android pager

孤人 提交于 2019-12-07 05:24:00
问题 Can anyone tell how to hide the app title bar in Pager fragment. 回答1: This should be enough: ActionBar bar = getActionBar(); // you might need to use getSupportActionBar() based on your project setup bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowHomeEnabled(false); 回答2: Warren is correct. And if you want to hide it in your theme, you can do it by inheriting from a theme that does not display it: For pre-Honeycomb styles: <style name="HiddenActionBar" parent="@android:style/Theme">

how to replace one full-screen dialog fragment with another without showing parent activity?

 ̄綄美尐妖づ 提交于 2019-12-07 04:49:39
问题 I have an Activity that uses a single custom DialogFragment class. Its appearance is data driven, so it can look fairly different from invocation to invocation. It is "full screen", i.e. setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme); In response to the result of a network call I dismiss() the currently showing instance (if there is one) and show() a new one: final CustomDialogFragment dialog = (CustomDialogFragment) getSupportFragmentManager().findFragmentByTag(DIALOG_TAG

Embedding Cordova WebView, Receiver is not registered

我怕爱的太早我们不能终老 提交于 2019-12-07 03:56:14
问题 I have embedded the Cordova WebvView as a component to my project, everything works fine except one thing; when the back button is pressed I get an error on LogCat which says "Receiver Not Registered !" I dont think I have registered a receiver. There is also a sample project on GitHub here. I also get the same error when I run this application. What I want to do is, embed Cordova WebView into my Android project and run some javascript functions. Here is my main activity; public class

FragmentPagerAdapter not restoring fragments upon Orientation Change

心已入冬 提交于 2019-12-07 00:37:34
问题 EDIT: I found out that the Activity is saving the instance, but the Fragments saved data is not making it up to the Activity savedInstanceState. I'm saving the current time in the outState, but its not making its way all the way up, as the activity has nothing in its SavedInstanceState for the time and returns 'null' for the time if I print it to the logcat.... I am building an application that has the a countup and countdown timer built in. The basic hosting activity for the timers is a

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

倾然丶 夕夏残阳落幕 提交于 2019-12-06 12:09:31
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 Fragments when you press the back button the AlertDialog I created pops up). I've looked into Fragment

Passing data between Fragments in View Pager

主宰稳场 提交于 2019-12-06 11:52:13
Need help in passing data between Fragments in View Pager! We tried passing data as bundle inside Fragments. Inside the Fragment.getInstance() method and tried getting the data from the other Fragment.getArguments(). Activity Code package com.northerly.bumpr; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView;

How to get the selected Tab of a viewPager?

瘦欲@ 提交于 2019-12-06 04:43:43
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) % CONTENT.length]); return StudentTaskFragment.newInstance(); } else if(position == 1){ return

Android Youtube Player in Fragment and Activity causes black screen

試著忘記壹切 提交于 2019-12-06 01:19:36
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 in slidingMenu activity and activity B as activity. For Fragment i am using youtubesupportfragment and