android-fragmentactivity

can't use method “getString(int resId)” in FragmentPagerAdapter

浪尽此生 提交于 2020-08-22 19:12:01
问题 I've the following class in my fragment activity now i want to get name of tabs from strings.xml but i can't able to use method getString(int resId) it gives a error message "Cannot make a static reference to the non-static method getString(int) from the type Context". In method public CharSequence getPageTitle(int position) I need to get like this name = getString(R.string.mystring) any help is appreciated. public static class AppSectionsPagerAdapter extends FragmentPagerAdapter { public

How to pass data from a activity to a recycler view adapter in android

牧云@^-^@ 提交于 2020-08-10 21:16:11
问题 I'm trying to design a page where address are stored in recycler view -> cardview. When the user clicks the add address button from the Activity A the user is navigated to the add address page in Activity B . Here the user can input customer name, address line 1 and address line two. And once save button is clicked in Activity B , a cardview should be created under the add address button in the Activity A . This design is just like the amazon mobile app add address option. Could anyone give

How can I manage fragment and activity considering its creation orders?

左心房为你撑大大i 提交于 2020-05-14 13:00:10
问题 What I would like to do I would like to call Activity from Fragment to realize both transitions among fragments and activities simultaneously in an Android app. I have succeeded to call one specific method on activity file from fragment file, but I have trouble with calling an entire activity from a fragment. SampleFragment - MainActivity's fragmentMethod() is called once the button is clicked on the page Sample1Fragment - FormActivity is called once the button is clicked on the page

Fragment Unit Testing: launchFragment throws ClassCastException

半城伤御伤魂 提交于 2020-03-23 11:55:04
问题 I'm trying to call methods within my Fragment class in my unit test but I keep getting the error java.lang.ClassCastException: androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity cannot be cast to com.nu.rms.inspections.ui.activity.InspectionActivity I'm following Google's docs. I'm confused why the empty fragment activity is having a cast attempted to become my InspectionActivity (the parent activity the fragment resides in), perhaps this is expected? What can I do to

Fatal Exception: java.lang.RuntimeException: Unable to resume activity

人盡茶涼 提交于 2020-03-05 07:53:10
问题 Following is My Log Repost Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.maruticourier.android/com.marutideliver.activity.MainActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3069) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3098) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1350) at android.os

Passing data between Fragments in View Pager

孤街醉人 提交于 2020-02-02 10:39:41
问题 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

Passing data between Fragments in View Pager

半世苍凉 提交于 2020-02-02 10:38:48
问题 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

call a method on a fragment in a ViewPager

心已入冬 提交于 2020-02-02 05:46:30
问题 All I want to do is calling a function of my Fragment's class. But I can't seem to find a way to access the instance of my fragments which are in a ViewPager. my activity's xml: <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" /> There is no so I can't call findFragmentById()

How fix this: on logcat -->> error loading /system/media/audio/ui/Effect_Tick.ogg??

谁说胖子不能爱 提交于 2020-01-29 12:16:27
问题 I have a problem: error loading /system/media/audio/ui/Effect_Tick.ogg It's shown when I click navdraw icon. Anybody can help me?? This is errors on logcat: 04-20 01:42:11.240: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.280: E/SoundPool(639): error loading /system/media

How fix this: on logcat -->> error loading /system/media/audio/ui/Effect_Tick.ogg??

*爱你&永不变心* 提交于 2020-01-29 12:12:32
问题 I have a problem: error loading /system/media/audio/ui/Effect_Tick.ogg It's shown when I click navdraw icon. Anybody can help me?? This is errors on logcat: 04-20 01:42:11.240: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.251: E/SoundPool(639): error loading /system/media/audio/ui/Effect_Tick.ogg 04-20 01:42:11.280: E/SoundPool(639): error loading /system/media