android-bundle

Send data to fragment with FragmentTransaction

為{幸葍}努か 提交于 2020-05-11 05:58:28
问题 I'm in my fragment class calling this: @OnClick(R.id.blockedLinkLayout) public void onBlockedClick(){ final FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content, new SettingsBlockedUsersFragment(), FRAGMENT_TAG); ft.commit(); } And it just replace my current fragment with chosen one. And my question is, how can I send some data (e.g. String value) from my parent fragment to my child fragment using FragmentTransaction? 回答1: Just pass them in a bundle as

Send data to fragment with FragmentTransaction

天大地大妈咪最大 提交于 2020-05-11 05:56:31
问题 I'm in my fragment class calling this: @OnClick(R.id.blockedLinkLayout) public void onBlockedClick(){ final FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content, new SettingsBlockedUsersFragment(), FRAGMENT_TAG); ft.commit(); } And it just replace my current fragment with chosen one. And my question is, how can I send some data (e.g. String value) from my parent fragment to my child fragment using FragmentTransaction? 回答1: Just pass them in a bundle as

Send data to fragment with FragmentTransaction

 ̄綄美尐妖づ 提交于 2020-05-11 05:51:20
问题 I'm in my fragment class calling this: @OnClick(R.id.blockedLinkLayout) public void onBlockedClick(){ final FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content, new SettingsBlockedUsersFragment(), FRAGMENT_TAG); ft.commit(); } And it just replace my current fragment with chosen one. And my question is, how can I send some data (e.g. String value) from my parent fragment to my child fragment using FragmentTransaction? 回答1: Just pass them in a bundle as

Class X is not abstract and does not implement fun writeToParcel() defined in android.os.Parcelable

你离开我真会死。 提交于 2020-01-13 08:18:10
问题 In my Android app, I want to add a Bundle including a Place object described below to my Intent. Since serializable was slow and not recommended, I preferred Parcelable. Althoug I use Kotlin 1.3.31, I have problems parcelizing some data classes. Example: import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class Place(val street: String, val postal: String, val city: String) : Parcelable and Android Studio complains: Class 'Place' is not abstract and does not

Pass String between two fragments without using an activity

不想你离开。 提交于 2020-01-05 15:42:15
问题 I need to pass the string curDate between NewDateFragment and NewEventFrament, i see many peoples using Bundle, but using these i still having NullPointerException. I transform the CalendarView to one string named curDate. public class NewDateFragment extends Fragment { public String curDate; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

How to change the position of a spinner according to position of other spinner in two different activities

纵然是瞬间 提交于 2020-01-03 06:56:06
问题 I Have two android spinner dropdown in two differnt activity.But both spinner have same data from same sourec.I want to change in position of second Activity acording to position of first activity.How to resolve this issue ?. Updated code: First Activity: public class ServiceRequest extends BaseActivity implements OnItemClickListener { private List<Item> customerList = new ArrayList<Item>(); private SpinnerAdapter adapter; public static final String EXTRA_INTENT_CUSTOMER_LIST ="extra_intent

Resume old activity by passing new data in bundle

风流意气都作罢 提交于 2020-01-02 01:04:06
问题 I have couple of activities say A , B, C. Activity A starts B , B starts C and so on. In my app I have put a navigation drawer which allows users to go back to activity A. When user goes back to activity A I have passed some flags which don't actually restart the activity but just resumes it. intent = new Intent(activity, A.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); Now I m trying to pass some data using bundles. bundle.putInt("selectedTab",

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 558780 bytes when navigating between fragment

戏子无情 提交于 2019-12-25 03:54:00
问题 I am using Bundle to transfer data between activities and fragments. When I navigate from one fragment to new fragment, Without transferring data or using Bundle to get the data, Application is crashing with below error. > > 10-09 11:36:09.100 467-467/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 558780) 10-09 11:36:09.101 467-467/? > D/AndroidRuntime: Shutting down VM 10-09 11:36:09.101 467-467/? > E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xxxx.xxxxmobileapp

How to examine the size of the Bundle object in onSaveInstanceState?

三世轮回 提交于 2019-12-24 05:56:56
问题 I am using Android Studio 3.0.1 which allows to inspect the Bundle object in onSaveInstanceState : @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } To do so add a breakpoint and once the debugger stops right click the Bundle object as shown in the screenshot and select "Show Bundle Objects..." from the context menu. Then a window opens to list the Bundle objects as shown in this screenshot: Is there a way to find out how much memory the

Send argument through PendingIntent of NavDeepLinkBuilder

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 09:55:20
问题 I'm having some difficulties sending an argument through a PendingIntent of a notification using NavDeepLinkBuilder . I'm able to get the destination Activity to launch by clicking the notification, but the Activity 's Intent doesn't contain the argument value that I passed it through the NavDeepLinkBuilder . The Intent instead returns the defaultValue that I set in the nav graph - "noJobId". Notification creation : val notification = NotificationCompat.Builder(context, context.getString(R