oncreate

Does changing the configuration Kill the App and Restart it?

允我心安 提交于 2020-01-07 01:19:12
问题 I was reading This Tutorial section 6.1. And it says that, changing the configuration of an App causes the App to Restart? My question is, in what sense the App would Restart? does it mean that when the configuration changes, onStop() then onCreate() will be called? But this only happens when another App with higher priority needs memory! OR In the sense that, the onStop() then onRestart() then onStart() will be called? I created a sample App, with only onCreate() callback and with a Log

android: get dimension of extended view using addOnGlobalLayoutListener but fails

泪湿孤枕 提交于 2020-01-06 15:17:31
问题 I am implementing the following addOnGlobalLayoutListener so as to measure the Extended View (doodleView) in main activity (A)'s OnCreate section. doodleView = (DoodleView) findViewById(R.id.doodleView); doodleView.setOnTouchListener(this); doodleView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { doodleViewWidth = doodleView.getWidth(); doodleViewHeight = doodleView.getHeight(); } }); However, it underlines in red for

Restarting Activity creates duplicate fragments

冷暖自知 提交于 2020-01-06 05:48:07
问题 When my activity restarts i get duplicate fragments on top of each other, the new ones over the old ones, and only the most recent are editable My fragment looks like this, please ignore all unnecessary code, the application at this point is already quite large and it is difficult to separate one thing from another: package cu.me.cuanto; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget

Android: onCreate() getting called multiple times (and not by me)

▼魔方 西西 提交于 2020-01-01 08:39:10
问题 There is something I don't quite understand right now. My main activity class creates a Service, which creates a new thread that waits for a TCP connection. Once one comes in, it will start a new activity: Intent dialogIntent = new Intent(getBaseContext(), VoIPCall.class); dialogIntent.putExtra("inetAddress", clientSocket.getInetAddress()); dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplication().startActivity(dialogIntent); After that, the onCreate() method of that class gets

Image on start up / loading

人盡茶涼 提交于 2019-12-31 22:25:36
问题 I ma developing an app, which at the moment when it is loading from the onCreate point, I just have a black screen (until the app gets its footing). Looking at other apps they have a company logo or cool image that pops up for a few seconds, can someone tell me how to do this please? And if you can set it to display for a minimal time? 回答1: Create a new activity that displays the image for a few seconds and redirects to your main activity: public class SplashActivity extends Activity {

Android: Where to put activity's onCreate() code in a fragment?

穿精又带淫゛_ 提交于 2019-12-29 03:28:32
问题 I'm converting all my Activities to Fragments so that I can use them in a ViewPager. I've searched for this but I couldn't find a satisfying answer, so that's why I'm asking it here. In my Activities, I've written some code in the onCreate() method. I for example call some findViewById() s in order to link some xml-buttons to my Activity. I also make some views invisible in the onCreate() , set an OnClickListener() , fill a TextView with text and remove a Notification, all in the onCreate()

Is it normal for the “activity.onCreate()” method to be called multiple times

若如初见. 提交于 2019-12-28 13:47:29
问题 I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour? Thanks. 回答1: You might want to read through the documentation on the Activity lifecycle. OnCreate will only be called one time for each lifetime of the Activity. However, there are a number of situations that can cause your activity to be killed and brought back to life. Thus, onCreate will be called again. To support this properly, you can save state information in

Android - Request code in onCreate [closed]

女生的网名这么多〃 提交于 2019-12-25 18:27:52
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago . can I access the requestCode an activity received in its onCreate() method? I'd need it to understand if it is a "new" or "modify" operation. 回答1: Let's say you create an activity A : The activity lifecycle goes like this : A.onCreate() -> A.onStart() -> A.onResume() Then you call activity B from

multiple plugins Unity 4.1.2

半城伤御伤魂 提交于 2019-12-24 13:19:23
问题 I want to use two plugins at the same time.They work perfect individually.But when I use them both at the same time , one does not work but another works or vice versa. I have already read these links : Cannot start activity on Android through Unity http://forum.unity3d.com/threads/184960-Unable-to-start-activity-NullPointerException http://forum.unity3d.com/threads/149089-Android-Plugin-multiple-Android-Activity-problems?p=1058651&viewfull=1#post1058651 but It still crashes.Giving me

Creating circle in SurfaceView on button click android

こ雲淡風輕ζ 提交于 2019-12-24 04:12:26
问题 So essentially I am working on an app that creates a circle withing a SurfaceView. I want for a new circle to be generated inside the SurfaceView whenever pressing the "create" button. Each new circle would have a random speed, color, starting position along with a unique sequence number. It's easy enough to create a circle with a random color and starting position, but I was having some trouble getting the circle to draw only when I click on the create button. Whenever I try to create a