fragment

Bad window token, you cannot show a dialog before an Activity is created or after it's hidden

我的未来我决定 提交于 2020-05-09 20:06:00
问题 I am using an AppIntro library in my app. It has 3 slides. I want to ask the user something when the third slide is shown. To achieve that I am using material dialogs by afollestad. My code in the AppIntro Activity looks like that: @Override public void onNextPressed() { if(this.pager.getCurrentItem() == 2) { MaterialDialog dialog = new MaterialDialog.Builder(getApplicationContext()) .title("QR Code scannen") .content("Möchtest du den QR Code scannen oder selbst eingeben?") .positiveText(

How to show activity (which cannot be converted to fragment) using BottomNavigationBar?

喜你入骨 提交于 2020-05-09 07:16:27
问题 I have problem with showing my activity. I don't know how to implement methods from NoteActivity to HomeFragment . HomeFragment is carried out by BottomNavigationBar without executing a NoteActivity . NoteActivity- public class NoteActivity extends AppCompatActivity { private FirebaseFirestore db = FirebaseFirestore.getInstance(); private CollectionReference notebookRef = db.collection("Notebook"); private NoteAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) {

FragmentContainerView as NavHostFragment

亡梦爱人 提交于 2020-04-12 07:50:28
问题 Seems like using the FragmentContainerView doesn't work right out of the box? <androidx.fragment.app.FragmentContainerView class="androidx.navigation.fragment.NavHostFragment" android:id="@+id/fragment_nav_host" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/nav_app" /> Here's my code using fragment-ktx:1.2.0-rc01 and I'm just always getting this error: Caused by: java.lang.IllegalStateException: Activity ..

FragmentContainerView as NavHostFragment

好久不见. 提交于 2020-04-12 07:50:12
问题 Seems like using the FragmentContainerView doesn't work right out of the box? <androidx.fragment.app.FragmentContainerView class="androidx.navigation.fragment.NavHostFragment" android:id="@+id/fragment_nav_host" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/nav_app" /> Here's my code using fragment-ktx:1.2.0-rc01 and I'm just always getting this error: Caused by: java.lang.IllegalStateException: Activity ..

getSupportFragmentManager().findFragmentById returns null for google maps in fragment in android?

ぐ巨炮叔叔 提交于 2020-04-10 07:30:35
问题 I have a problem with Google Maps, i.e. getSupportFragmentManager().findFragmentById returns always null. Do you have an idea how to solve this? Here is the code: fragment_map.xml: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.myapp.something.MapFragment"> <fragment android:id="@+id/map" android:layout_width="match_parent" android

Proper use of sub sub fragments with (Child)FragmentManager

寵の児 提交于 2020-04-08 00:04:49
问题 How do I properly use Fragments in Fragments? My (simplified) use case is following, I have an activity with a layout fragment and this fragment theirself contains a sub fragment... all fragments are added manually to their parents... ---------------------------------------------------------- - Activity - - - - - - --------------------------------------- - - - Fragment - - - - - - - - ----------------- - - - - - SubFragment - - - - - - - - - - - - - - - - - ----------------- - - - -----------

Proper use of sub sub fragments with (Child)FragmentManager

二次信任 提交于 2020-04-08 00:03:05
问题 How do I properly use Fragments in Fragments? My (simplified) use case is following, I have an activity with a layout fragment and this fragment theirself contains a sub fragment... all fragments are added manually to their parents... ---------------------------------------------------------- - Activity - - - - - - --------------------------------------- - - - Fragment - - - - - - - - ----------------- - - - - - SubFragment - - - - - - - - - - - - - - - - - ----------------- - - - -----------

测试应用documentFragment 和 直接操作dom 的区别

假装没事ソ 提交于 2020-04-06 03:50:28
DocumentFragment 节点不属于文档树,继承的 parentNode 属性总是 null。 不过它有一种特殊的行为,该行为使得它非常有用,即当请求把一个 DocumentFragment 节点插入文档树时,插入的不是 DocumentFragment 自身,而是它的所有子孙节点。这使得 DocumentFragment 成了有用的占位符,暂时存放那些一次插入文档的节点。它还有利于实现文档的剪切、复制和粘贴操作 同时我们了解到当需要对页面DOM进行操作的时候必然会导致多次 重绘、回流( 什么是重绘,回流? )。这样会加大页面的负担。影响页面性能。因此我们可以创建这样一个临时占位符。 测试 demo: <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div id="box"> <button onclick="addList()">Button</button> <button onclick="addList2()">Button</button> </div> <div> <ul id="myList"> <li>item</li> </ul> <hr> </div> <script type="text/javascript"> function addList(){ var doc =

Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging

房东的猫 提交于 2020-04-05 06:48:13
问题 Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging I am using fragment reusability .but add second time fragment then start this problem. I am remove image load library but not any improvement i am face same problem. I am also check this link click add fragment then facing this problem. but replace fragment then not facing this problem more add fragment then RecyclerView lagging. i think fragment memory issue Every time user click see all related

Android自定义控件----RadioGroup实现APP首页底部Tab的切换

谁都会走 提交于 2020-04-02 17:44:11
​ 【声明】 欢迎转载,但请保留文章原始出处→_→ 生命壹号: http://www.cnblogs.com/smyhvae/ 文章来源: http://www.cnblogs.com/smyhvae/p/4463931.html 【正文】 实现APP首页底部Tab的切换已经见过四五种方式了,先来看运行的效果图吧: 今天我们就用RadioGroup的方法来实现以下。 【开发环境】 物理机版本:win 7旗舰版(64位) IDE版本:Android Studio 1.2 preview 工程文件结构:(本文最后有源码) HomeActivity.java:整个首页的界面 四个Fragment.java:对应的四个Fragment界面 drawable文件夹中是对应tab和文字切换的状态 剩下的xml文件就是对应的Activity和Fragment的布局文件了。 一、布局文件: (1) activity_home.xml :HomeActivity的布局文件 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4