onpause

android - There is no default constructor for ArrayAdapter

让人想犯罪 __ 提交于 2019-11-29 07:58:49
I m making adapter to adapt my book collection to be visible in list view. Issue is solved if I add super(context, position): public BookAdapter(Context context, int position, List <Book> updatedBooksList) { super(context, position); this.context = context; this.booksList = updatedBooksList ; } However, I want to know why I need this argument (int position) and call superclass constructor? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Also, in the broader sense why do we always(?) need to call super.onCreate like here in every onCreate? Aren't we

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

Broadcastreceiver and Paused activity

时光怂恿深爱的人放手 提交于 2019-11-28 05:28:53
I have a broadcast receiver registered programatically in a activity. It responds to the PACKAGE_REMOVED intent, that fires when a package gets removed. The problem is, it doesn't get this message. I think this is due to that the intent is fired when I leave the activity and move to another activity to uninstall a app, so the original activity is paused. Could it be that a paused activity (where the receiver is not unregistered in onPause ) also pauses the receiver? When you register a broadcast receiver programatically in an activity, it will NOT get broadcasts when the activity is paused.

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: How to pause and resume a Count Down Timer?

本小妞迷上赌 提交于 2019-11-27 12:26:35
I have developed a Count Down Timer and I am not sure how to pause and resume the timer as the textview for the timer is being clicked. Click to start then click again to pause and to resume, click again the timer's text view. This is my code: Timer = (TextView) this.findViewById(R.id.time); //TIMER Timer.setOnClickListener(TimerClickListener); counter = new MyCount(600000, 1000); }//end of create private OnClickListener TimerClickListener = new OnClickListener() { public void onClick(View v) { updateTimeTask(); } private void updateTimeTask() { if (decision == 0) { counter.start(); decision =

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

onDestroy gets called each time the screen goes on

北城余情 提交于 2019-11-27 08:16:54
My application gets killed each time that it comes back from the screen-off-state. I fetch all the information that my app does, but I can't find out why it calls onDestroy. It's the first time I'm seeing this behavior in my applications. My main activity extends tabActivity because it contains a tabhost. I've read that it has to extend it or it will FC. I'm not sure if my issue is related to this?! Oh and it implements Observer but this should be no problem. Here are the logs: 07-21 09:57:53.247: VERBOSE/###(13180): onResume 07-21 09:57:53.267: VERBOSE/###(13180): onPause 07-21 09:57:59.967:

onPause() and onStop() in Activity

跟風遠走 提交于 2019-11-27 04:15:43
问题 I am new to Android development and I am still not able to understand the onPause() and onStop() methods in an activity. In my app, I have a static class that I name Counter, and it keeps the state of variables in memory for the app. My app runs fine in the emulator. What I was trying to test was differential behavior of onPause() versus onStop() . For onPause , I wanted the values stored in the Counter class's members retained, whereas calling onStop() I wanted the counter values reset to

Broadcastreceiver and Paused activity

青春壹個敷衍的年華 提交于 2019-11-27 01:02:17
问题 I have a broadcast receiver registered programatically in a activity. It responds to the PACKAGE_REMOVED intent, that fires when a package gets removed. The problem is, it doesn't get this message. I think this is due to that the intent is fired when I leave the activity and move to another activity to uninstall a app, so the original activity is paused. Could it be that a paused activity (where the receiver is not unregistered in onPause ) also pauses the receiver? 回答1: When you register a

Android: How to pause and resume a Count Down Timer?

≯℡__Kan透↙ 提交于 2019-11-26 16:03:31
问题 I have developed a Count Down Timer and I am not sure how to pause and resume the timer as the textview for the timer is being clicked. Click to start then click again to pause and to resume, click again the timer's text view. This is my code: Timer = (TextView) this.findViewById(R.id.time); //TIMER Timer.setOnClickListener(TimerClickListener); counter = new MyCount(600000, 1000); }//end of create private OnClickListener TimerClickListener = new OnClickListener() { public void onClick(View v)