android-activity

android.os.Parcelable[] cannot be cast to… Error

可紊 提交于 2021-02-07 09:47:57
问题 I'm doing a project for my class and I'm having an issue with it. I get the following error when I add a book There is a parcelable authors class that will be an array and a parcelable books class. The authors get stored in the book parcelable : Error: java.lang.RuntimeException: Failure delivering result ResultInfo {who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {edu.stevens.cs522.bookstore/edu.stevens.cs522.bookstore.activities.BookStoreActivity}: java.lang

Android memory management granularity - Activity or Process?

最后都变了- 提交于 2021-02-07 02:47:52
问题 I am seeing inconsistent documentation and discussion regarding what happens when Android is low on memory and the steps the OS takes to re-claim memory. More specifically, does Android kill at the granularity of activity/fragment, or entire process? For example, if Activity B is launched in front of Activity A (and both activities are part of the same app/process), can Activity A be killed by the OS while Activity B is in the foreground and the user is interacting with Activity B (assume:

Android memory management granularity - Activity or Process?

你离开我真会死。 提交于 2021-02-07 02:47:44
问题 I am seeing inconsistent documentation and discussion regarding what happens when Android is low on memory and the steps the OS takes to re-claim memory. More specifically, does Android kill at the granularity of activity/fragment, or entire process? For example, if Activity B is launched in front of Activity A (and both activities are part of the same app/process), can Activity A be killed by the OS while Activity B is in the foreground and the user is interacting with Activity B (assume:

Android-Libgdx, Calling Another Activity after the Game starts on Button click

孤街醉人 提交于 2021-02-06 18:47:13
问题 I faced a major problem when I need to call another activity when the button is clicked after the Game is started. The Game is called via initiate(game, ) method from AndroidApplication interface. In normal Activity, I can easily call the another Activity but it seems to be difficult to call another Activity from Libgdx class that implements AndroidApplication. Could anyone suggest a proper method to call the Activity from Libgdx class that implements AndroidApplication interface? I tried to

Android-Libgdx, Calling Another Activity after the Game starts on Button click

落花浮王杯 提交于 2021-02-06 18:44:06
问题 I faced a major problem when I need to call another activity when the button is clicked after the Game is started. The Game is called via initiate(game, ) method from AndroidApplication interface. In normal Activity, I can easily call the another Activity but it seems to be difficult to call another Activity from Libgdx class that implements AndroidApplication. Could anyone suggest a proper method to call the Activity from Libgdx class that implements AndroidApplication interface? I tried to

Attempt to invoke virtual method 'android.view.View android.view.Window.findViewById(int)' on a null object reference

二次信任 提交于 2021-02-05 11:21:45
问题 Basically this app is supposed to ask for your name, with an option to save, which when click, an alert dialog pops up and asks 'are you sure?', when yes is clicked, it should say 'welcome + whatever name put'. my problem is that the app keeps shutting down before it says welcome. I declared the string as userName and ran it without any function to the string, and it just said 'welcome, null'. but when i did userName=editText.getText().toString(); the app shut down immediately. Please HELP I

How pass data between activities using RxJava in android?

谁说我不能喝 提交于 2021-02-04 17:33:09
问题 I need to pass some data between two activities MainActivity and ChildActivity . Button click on MainActivity should open ChildActivity and send event with data. I have singleton: Subject<Object, Object> subject = new SerializedSubject<>(PublishSubject.create()); and in MainActivity I have the following button click handler: public void onClick(){ startActivity(new Intent(MainActivity.this, ChildActivity.class)); subject.onNext(new SomeEvent(data)); } and event listener subscription in

Use of onDestroy( ) in android

放肆的年华 提交于 2021-02-04 16:54:07
问题 If java provides Garbage Collection, then what is the need of onDestroy() in Activity LIfecycle ? 回答1: onDestroy: The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space. Here is an example...... public void onDestroy() { super.onDestroy(); } 回答2: OS decides when things "go away." The onDestroy is there to

Children of LinearLayout not drawn when returning from another activity

旧时模样 提交于 2021-01-29 16:47:43
问题 On app startup, all children of the LinearLayout (LL) are rendered. But, with the same code when coming from another activity, no children of the LL are visible, nevertheless included in the view tree. See: The activity_main.xml is: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id

Click a notification to open a new temporary activity page and then return to the main activity (Xamarin Android)

家住魔仙堡 提交于 2021-01-29 09:11:14
问题 This question is related to my previous question. Now, the method SendNofitication is added. I have two activities: [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] public class MainActivity : AppCompatActivity { DateTime time = DateTime.Now; void SendNofitication(string title, string text) { TaskStackBuilder stack_builder = TaskStackBuilder.Create(this); stack_builder.AddParentStack(Java.Lang.Class.FromType(typeof(Activity2))); Intent intent = new Intent