android-fragments

NavigationDrawer with Activities vs. NavigationDrawer with Fragments

半世苍凉 提交于 2020-06-07 09:28:46
问题 Take for example the app I'm currently working on: - it has an navigationDrawer with multiple items; there are two items which interest me for now, i'll call them X and Y. both X and Y, when clicked on, display a fragment containing a list of x-elements or y-elements selecting and x or y list element displays a new fragment in which I display info about the select item; the view fragments are different for x and y elements in the view fragment I can choose to edit the specific element which

Android kotlin show Navigation Drawer icon instead of Back Button in some fragment

我是研究僧i 提交于 2020-06-01 07:39:06
问题 I want to show navigation drawer icon instead of Back button on a certain fragment. I created the App with Navigation graph. Let's say i have 2 fragments ( LoginFragment and DashboardFragment ) and one activity ( MainActivity ) MainActivity.kt class MainActivity : AppCompatActivity() { lateinit var drawerLayout: DrawerLayout override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val binding = DataBindingUtil.setContentView<ActivityMainBinding>(this, R.layout

Use the same instance of view model in multiple fragments using dagger2

痴心易碎 提交于 2020-06-01 05:36:25
问题 I am using only dagger2 ( not dagger-android ) in my project. It's working fine to inject the ViewModel using multibinding. But there's one problem with that previously without dagger2 I was using the same instance of viewmodel used in activity in multiple fragments (using fragment-ktx method activityViewModels()), but now since dagger2 is injecting the view model it's always gives the new instance (checked with hashCode in each fragment) of the viewmodel for each fragment, that's just breaks

How to run my RecyclerView with CardView in fragment?

久未见 提交于 2020-05-29 11:18:32
问题 I have this code and everytime I tried to run it ..the application is not running not error but not running can anyone please help me to determine what is the reason for getting this kind of problem. because I'm doing RecyclerView with CardView in fragment I have this problem almost a week :( this is my code: public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> { private Context mContext ; private List<Book> mData ; public RecyclerViewAdapter(Context

textview content is getting trimmerd after viewpager swipe back

我们两清 提交于 2020-05-28 07:25:45
问题 The bounty expires in 20 hours . Answers to this question are eligible for a +50 reputation bounty. AskQ is looking for a canonical answer . I have a viewpager which has 10 fragments. when i swipe back to 2nd fragment from 9th fragment, textview's content is getting trimmed as shown in below image! It is only showing first letter of all textviews. What's the issue? Code ViewPagerAdapter: public class ViewPagerAdapter extends FragmentStatePagerAdapter { ArrayList<String> arrayList; int baseId

textview content is getting trimmerd after viewpager swipe back

一笑奈何 提交于 2020-05-28 07:25:26
问题 The bounty expires in 20 hours . Answers to this question are eligible for a +50 reputation bounty. AskQ is looking for a canonical answer . I have a viewpager which has 10 fragments. when i swipe back to 2nd fragment from 9th fragment, textview's content is getting trimmed as shown in below image! It is only showing first letter of all textviews. What's the issue? Code ViewPagerAdapter: public class ViewPagerAdapter extends FragmentStatePagerAdapter { ArrayList<String> arrayList; int baseId

textview content is getting trimmerd after viewpager swipe back

别等时光非礼了梦想. 提交于 2020-05-28 07:24:17
问题 The bounty expires in 20 hours . Answers to this question are eligible for a +50 reputation bounty. AskQ is looking for a canonical answer . I have a viewpager which has 10 fragments. when i swipe back to 2nd fragment from 9th fragment, textview's content is getting trimmed as shown in below image! It is only showing first letter of all textviews. What's the issue? Code ViewPagerAdapter: public class ViewPagerAdapter extends FragmentStatePagerAdapter { ArrayList<String> arrayList; int baseId

Android Tab Fragments load at same time

吃可爱长大的小学妹 提交于 2020-05-28 01:40:49
问题 I am newbie at android and I try to build tab activity. It is my MainActivity: public class MainActivity extends AppCompatActivity { Toolbar toolbar; TabLayout tabLayout; ViewPager viewPager; ViewPagerAdapter viewPagerAdapter; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolBar); setSupportActionBar(toolbar); tabLayout = (TabLayout) findViewById(R.id.tabLayout); viewPager

Camera2 API Make Preview Fill Entire View

坚强是说给别人听的谎言 提交于 2020-05-27 10:36:32
问题 I am using the Camera2Basic example from Google Samples (https://github.com/googlesamples/android-Camera2Basic) to display a camera preview inside a fragment. This fragment contains a RelativeLayout and a custom AutoFitTextureView. The latter can be found on the link above. I have adjusted the layout to center the preview and remove control buttons: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match

Camera2 API Make Preview Fill Entire View

半世苍凉 提交于 2020-05-27 10:34:29
问题 I am using the Camera2Basic example from Google Samples (https://github.com/googlesamples/android-Camera2Basic) to display a camera preview inside a fragment. This fragment contains a RelativeLayout and a custom AutoFitTextureView. The latter can be found on the link above. I have adjusted the layout to center the preview and remove control buttons: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match