android-fragmentactivity

Cannot acces ActivityCompatApi23 when trying to use FragmentActivity

廉价感情. 提交于 2019-12-10 12:54:12
问题 I'm trying to use a ViewPager on my smartwatch, but I keep getting an error when trying to rebuild/run/debug my application. I'm using a FragmentActivity, which is where the error occurs. I searched stackoverflow and tutorial websites to see what could be the problem, and a lot of results are related to the build.gradle files. However I tried pretty much everything I stumbled upon, but the error didn't change once. The error: Error: Cannot acces ActivityCompatApi23 The error happens on this

MapFragment can't be cast to android.support.v4.app.Fragment (HERE MAP API Mobile)

核能气质少年 提交于 2019-12-10 12:24:03
问题 I have some error with MapFragment i use HERE MAP API for Mobile. I'll try to add MapFragment in FragmentTabHost and my MapFragment Class I'm use FragmentActivity class name is "EventMap" My app is going like this:i have mainActivity is a ActionBarActivity and when i click a menu from this the app is going to FragmentTabHost. At FragmentTabHost i have two tab frist tab is a ListFragment for show my data and second is a EventMap.class .Now when i run the app and go to EventMap i got the error

Reading SharedPreferences data in Fragment, within FragmentActivity

自古美人都是妖i 提交于 2019-12-10 10:27:13
问题 I'm trying to save the name the user enters on the log in screen below Settings.java to a sharedPreference , which will be read by TestFragment2.java , which is called from another FragmentActivity, SampleTabsDefault.java Settings.java private void savePrefs(String key, boolean value) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); Editor edit = sp.edit(); edit.putBoolean(key, value); edit.commit(); } private void savePrefs(String key, String value) {

YouTubePlayerSupportFragment starts duplicate Activity

廉价感情. 提交于 2019-12-10 03:26:14
问题 I am using a YouTubePlayerSupportFragment to embed a YouTube video in my app. When embedded it works very well, the video plays, everything is great. When I tap the Fullscreen button my embedded YouTube video fragment, the first strange thing happens: It instantiates a new copy of the existing enclosing Activity... and I have no idea why. I have one Activity, RootActivity, which displays several fragments in a ViewPager. The fragment I'm dealing with at the moment is called

Intercepting ActionBar Home button in Fragment

大憨熊 提交于 2019-12-09 13:28:24
问题 I can successfully intercept the ActionBar home button from my NavigationDrawerFragment , which is added to my MainActivity , like so: @Override public boolean onOptionsItemSelected(MenuItem item) { if (!loggedIn() && item.getItemId() == android.R.id.home) { login(); return true; } return super.onOptionsItemSelected(item); } However, in my ComposeActivity with ComposeFragment this does not work. onOptionsItemSelected is not called on the fragment. I have debugged the code and the issue seems

I'm having problems with running the code on my device [duplicate]

旧城冷巷雨未停 提交于 2019-12-09 04:00:34
问题 This question already has answers here : Explanation of “ClassCastException” in Java (11 answers) Closed last year . Here is my problem. Below is my class (Events.java) below it is the error. I continue to run my code on my phone but continue to get that error. I don't know what exactly the problem is and I don't know how to fix it. I tried everything I looked up but kept getting errors. Please help I'm a noob obviously. package com.androidapp.restart; import android.app.Fragment; import

Can a fragment extend a fragment activity? [Android]

帅比萌擦擦* 提交于 2019-12-08 18:58:41
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); return v; /* R.layout.fragment1 only contains a TextView. */ } } For the 2nd Fragment, I want to

Tabs + ViewPager + FragmentStatePagerAdapter - How to remove fragment?

假如想象 提交于 2019-12-08 15:48:03
问题 I'm using the "Tabs + Swipe" project and I'm having a difficult time removing a fragment. Steps I'm doing: Remove tab from database Remove tab from the FragmentStatePagerAdapter data source Remove tab from the actionBar. Remove fragment using Support FragmentManager. The problem: After I perform the remove, for some reason, I can still scroll to the right and see an empty fragment. I can't select it, it just bounces back. It seems like the fragment is not being removed but rather changes its

Fragment Transaction loads a blank view

戏子无情 提交于 2019-12-08 12:44:07
问题 The issue appears to be that fragments seem to load in a very strange way in RARE occurrences. Sometimes the view of a Fragment is NOT visible, onCreateView is called, but it does NOT add the view to the activity, it just loads a blank white page. When onResume is called from resuming the app (such as going to recent applications and clicking my app) the view appears. ALL fragment transactions are done on the MAIN thread obviously. This happens approx 1 in every 20 times. I am happy to supply

Drawer Layout Overlapping | Covering complete space in Fragment

旧街凉风 提交于 2019-12-08 10:10:35
问题 Hi I am trying to implement Feed App and implementing Navigation Drawer, Tab Layout and Recyclerview in Fragment. See Screenshots here : Screenshot With out Drawer layout Screenshot of app with Drawer layout Here is my code. activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout