onresume

How to mute and unmute it on the onPause and onResume

核能气质少年 提交于 2019-11-28 09:51:25
问题 I'm having a problem when I set the audio to Mute on the onPause() and in the onResume() I try to unmute it but without success. Code: protected void onPause() { super.onPause(); Log.d(TAG, "onPause"); setStreamMute(true); } protected void onResume() { super.onResume(); Log.d(TAG, "onResume"); setStreamMute(false); } public void setStreamMute (boolean state){ Log.d(TAG,"SetMute: "+state); myAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); myAudioManager.setStreamMute

Which activity method is called when orientation changes occur?

吃可爱长大的小学妹 提交于 2019-11-28 06:16:59
Which method of the lifecycle is called when orientation changes occur? My application executes the onResume() method or maybe reloads the whole activity because I've set one boolean to check whether it is first run or not. I've read onConfigurationChanged() starts when orientation change occur, is it true? How to handle this? Siten Interesting one... Activity is start onResume() is which you declare in your XML by default. And as I found from question answer on stack overflow is: Orientation Change onSaveInstanceState onPause onStop onCreate onStart onRestoreInstanceState onResume Switch TO

Canvas draw functions not working after screen locked and unlocked

人走茶凉 提交于 2019-11-28 03:00:02
问题 I'm working on an augmented reality application in which I have a camera preview screen on which I draw some markers which moves with respect to device movement. When I lock and unlock the device, the markers freezes and doesn't move further. I'm unable to find the reason why this happens.Is there any possible work around for this? Any help will be greatly appreciated. My SurfaceView class: public class CameraSurface extends SurfaceView implements SurfaceHolder.Callback { private static

Android onCreate onResume

你说的曾经没有我的故事 提交于 2019-11-28 02:42:51
问题 I have a problem. When I start for the first time my android application, in the main activity both the onCreate and the onResume are called. but I want to be called only the onCreate. What can I do? 回答1: According to the SDK docs what you are seeing is the intended behavior. Have a look at the flowchart in the docs for Activity - Activity Lifecycle. Programmatically you can overcome this by keeping an instance member to track whether onResume has been called before - the first time it is

Android example which uses onResume, onStart and onRestart

自作多情 提交于 2019-11-28 02:02:56
I would like an example Android app which uses onResume, onStart and onRestart. Abhishek Susarla package com.test; import stuff here public class Pick_Color extends Activity implements OnClickListener { private Button b11; private Button b12; private Button b13; private Button b14; private Button b_final; private EditText RED; private EditText GREEN; private EditText BLUE; static int temp_red; static int temp_green; static int temp_blue; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pickcolor); Log.d("pick color","on create"); b11

Using onResume() to refresh activity

巧了我就是萌 提交于 2019-11-28 00:16:02
问题 I can't for the life of me figure out how to have an activity be refreshed after pressing the back button. I currently have activity A that fires an intent to goto B and while on act B if you press back I want to go back to act A but have it refresh itself. I can use this intent to refresh the activity currently: Intent refresh = new Intent(this, Favorites.class); startActivity(refresh); this.finish(); But I can't figure out how to properly use the onResume() function to refresh my act A

How to use onResume()?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 18:26:43
Can anyone give me an example that uses onResume() in Android? Also, if I want to restart the activity at the end of the execution of another, which method is executed— onCreate() or onResume() ? And if I want to update data, how do I put it in onResume()? Mr.Sandy Any Activity that restarts has its onResume() method executed first. To use this method, do this: @Override public void onResume(){ super.onResume(); // put your code here... } Viswanath Lekshmanan Restarting the app will call OnCreate() . Continuing the app when it is paused will call OnResume() . From the official docs at https:/

Alternative for the onResume() during Fragment switching

孤人 提交于 2019-11-27 11:28:55
onResume() method won't get called when we switch between fragments more than one time. So, is there any better way to handle resume operation? Dhaval Code follows: Step: 1 Create Interface : public interface YourFragmentInterface { void fragmentBecameVisible(); } Step: 2 Attach Listner In setOnPageChangeListener : mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(final int position, final float v, final int i2) { } @Override public void onPageSelected(final int position) { YourFragmentInterface fragment = (YourFragmentInterface)

Android - Performing stop of activity that is not resumed

寵の児 提交于 2019-11-27 11:19:50
When I push my app to background, and do some other stuff like whatsapp or sms, onResume it works great. But I recently discovered that when I open/launch facebook app while my app is on background, I don't know what happens... But onResume, the app misbehaves... Don't do what it is required to do, but when I go back to homepage and come back it works fine Please help me out.. how to fix it ??? Logcat with all messages (without filter) 10-15 12:53:59.899: I/Adreno-EGL(32033): Remote Branch: quic/LNX.LA.3.5.1_RB1.1 10-15 12:53:59.899: I/Adreno-EGL(32033): Local Patches: NONE 10-15 12:53:59.899:

ViewPager with fragments - onPause(), onResume()?

徘徊边缘 提交于 2019-11-27 11:18:48
When using ViewPager with fragments, our onPause(), onResume() methods are not called when moving between tabs. Is there any way we can figure out in the fragment when we're being made visible or being hidden? Unfortunately I have logic in onResume(), onPause(), like registering with location services, that never get stopped when switching tabs because onPause() never gets called until one exits the whole app. Thanks The ViewPager comes with the OnPageChangeListener interface. By setting some flags for the previous and currently shown pages, you can emulate this behavior. Considering previous