fragment

Intent within fragment works only half the time

▼魔方 西西 提交于 2019-12-25 04:13:16
问题 I am trying to pass an intent with data from Activity A to FragmentActivity B to Fragment B. A button from Activity A starts FragmentActivity B. The "year" string sets a filter with which I query a mysql database on a remote server. The code below works but only half the time. I have no idea what causes it to filter just some times and at other times it just returns the whole table unfiltered. I am guessing it has to be related to the intent I am using in the fragment because the filter

NullPointerException with Fragment Interface Listener

三世轮回 提交于 2019-12-25 03:25:16
问题 I'm sorry, I'm sure that this will be simple but I just cannot see where I'm going wrong here. I've got a Fragment (a tool list) that can start a number of other fragments (tools) in a two pane set up. There is an activity that sits above & I am using it to manage the removal of tool fragments when their 'close button' is pressed. It then pops a tool from the backstack if one exists. The strange thing is, that I have this working within one fragment but the 'cut & pasted' code into another

How to start Activity from Fragment? Android

泪湿孤枕 提交于 2019-12-25 02:37:07
问题 I am new to Android apps development. I use this open source sliding menu with fragments: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ I want to implement this rss feed parser (AndroidRssReader, also open source) in sliding menu project: http://android-er.blogspot.in/2010/04/simple-rss-reader-using-androids.html My idea is, that one of the sliding menu items (one fragment), starting an AndroidRssReader.java activity. I was put AndroidRssReader.java file in

Optimizing Parent Fragment for ViewModel and DataBinding in order to avoid boilerplate code

天大地大妈咪最大 提交于 2019-12-25 01:47:17
问题 I have a ParentFragment and a ChildFragment . They are working pretty fine. My problem is that in the future I might create many child fragments and this makes me write this boilerplate code for every single child fragment. Thus, I would like to optimize my ParentFragment so that I do not have to write boilerplate code for every single new child framment I create in the future. ParentFragment abstract class ParentFragment<T: ViewDataBinding>: Fragment() { @LayoutRes abstract fun

GLSL 三种变量类型(uniform,attribute和varying)

我只是一个虾纸丫 提交于 2019-12-25 01:23:35
1.uniform变量 uniform变量是外部程序传递给(vertex和fragment)shader的变量。因此它是application通过函数glUniform**()函数赋值的。在(vertex和fragment)shader程序内部,uniform变量就像是C语言里面的常量(const ),它不能被shader程序修改。(shader只能用,不能改) 如果uniform变量在vertex和fragment两者之间声明方式完全一样,则它可以在vertex和fragment共享使用。(相当于一个被vertex和fragment shader共享的全局变量) uniform变量一般用来表示:变换矩阵,材质,光照参数和颜色等信息。 以下是例子: uniform mat4 viewProjMatrix; //投影+视图矩阵 uniform mat4 viewMatrix; //视图矩阵 uniform vec3 lightPosition; //光源位置 uniform float lumaThreshold; uniform float chromaThreshold; uniform sampler2D SamplerY; uniform sampler2D SamplerUV; uniform mat3 colorConversionMatrix; 2

怎么跳过阿里腾讯框架面试中的陷阱?这样做!高效学习移动开发

╄→гoц情女王★ 提交于 2019-12-25 00:23:37
这两年移动端发展的越来越快,在ios上特别明显,而Android也是遭遇到了很多打击 特别随着初中级Android开发的逐渐饱和,也让企业在甄选Android面试候选人时变得格外严格,恨不得找一位Android开发做所有的事 我在平时的工作中也是一直接触较多候选人,就这里想和大家说下我对于Android面试的一些看法 1.首先对于Android基础知识的掌握必须要通透! 我把Android基础知识分为:四大组件Activitiy、service、广播、内容提供者,还有fragment,当然这些知识点也不是独立的,每个之间都有融合再一起的知识 比如Activity这个知识点,首先我们需要掌握Activity的使用场景 最常见的在这个Activity中通过嵌入fragment来进行整个项目UI架构的搭建,这时候这个Activity就是整个项目的一个外壳 我们还需要了解整个Activity的生命周期,要知道在那些方法中可以做耗时操作,哪些方法是不可以做耗时操作 在掌握Activity时,我们还需要注意Context的使用,区分在哪些场景可以使用Application context,哪些场景我们尽量使用Activity context 接下来我们还需要掌握Activity的启动模式,知道哪些场景下使用singleTask、哪些场景下使用singTop。 我们回到我们的面试

Fragment IllegalStatexception on getResources()

懵懂的女人 提交于 2019-12-24 19:52:08
问题 I have this line inside SubCategoryFragment : s.group_name = SubCategoryFragment.this.getResources().getString(R.string.everything_else); // line 315 in stacktrace My understanding was that by adding SubCategoryFragment.this to this would prevent the IllegalStatexception. This is a ListFragment . This occurs when someone clicks on a list item in this fragment, and goes to another; then hits the back button and returns to SubCategoryFragment . onActivityCreated() where this line above

UploadingItemAdapter gives LogCat null value and listItem's text views are also remains blank in fragment of listview

本秂侑毒 提交于 2019-12-24 18:54:23
问题 I don't know in which part i made mistake. In UploadItemAdapter.class,uploadingDetails.getTitle() and uploadingDetails.getDiscription() both gives me null in my log cat. In android listView screen textView of item is also remains blank Screenshot .My Computer Screen. My code is mentioned below. UploadItemAdapter.java package com.example.shiva.gconnection.extendedVersion; import android.content.Context; import android.support.v4.app.FragmentActivity; import android.util.Log; import android

kotlin android bottom navigation fragment setRetainInstance(true)

岁酱吖の 提交于 2019-12-24 18:52:02
问题 I created an bottom navigation project with 4 fragment and put setHasOptionsMenu(true) in onCreate() of the qponFragment in order to keep the same content of qponFragment after switching around the Fragments. However, it doesn't work, the qponFragment is still refreshed after switching back from other fragments. please help to fix it and find out what is the problem with my code. Here with the code for MainActivity.kt class MainActivity : AppCompatActivity() { private var mFirebaseAnalytics:

How to save the fields data while changing the Layout on screen rotation

纵饮孤独 提交于 2019-12-24 18:08:03
问题 I have read a lot of things about the data save instance and restore but Unable to implement in my case. What is my case in application . I am using the Activity (MainActivity) and calling the fragment in it let say ParentFragment ParentFragment Calls the ChildFragment in it though ParentFragment has its own views such as TextViews which takes First name, Last name and age and below this part I am programatically calling the ChildFragment So in this way I have 2 fragments in the MainActivity,