activity

iOS - is Motion Activity Enabled in Settings > Privacy > Motion Activity

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If an app requires access to Motion Activity data it asks the user at install. However if the user accidentally answers 'No', then the app will not work. I am looking for a way to check if the Motion Activity is enabled, so that I can prompt the user to enable if not. Can someone point me in the right direction code wise please? Following the info from Doc (Thank you), it seems that Apple do not provide a direct method to check the status of Motion Activity in Privacy. I was able to find out by picking up on the error:- [stepCounter

Start activity on boot

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to start my app just after the phone boot. Apparently the app is started after the boot but it immediately crashes (just to be clear the app normally works fine). I have already read and tried different solutions ( link1 , link2 ) and actually the same code works fine with another app I was developing. Here's the code: AndroidManifest.xml: StartMyActivityAtBootReceiver.java: public class StartMyActivityAtBootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if ("android.intent

Android: Go back to previous activity

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to do something simple on android app. How is it possible to go back to a previous activity. What code do I need to go back to previous activity 回答1: Android activities are stored in the activity stack. Going back to a previous activity could mean two things. You opened the new activity from another activity with startActivityForResult . In that case you can just call the finishActivity() function from your code and it'll take you back to the previous activity. Keep track of the activity stack. Whenever you start a new activity with

NullPointerException when trying to check permissions

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to check if the user has android.Manifest.permission.ACCESS_FINE_LOCATION enabled. When running the application, I get a NullPointerException error. package dtt.romano.rsrpechhulp; import android . app . Activity ; import android . content . Context ; import android . content . IntentSender ; import android . content . pm . PackageManager ; import android . location . Location ; import android . os . Bundle ; import android . support . annotation . NonNull ; import android . support . v4 . app . ActivityCompat ; import

Calling startActivity() from outside of an Activity context

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have implemented a ListView in my Android application. I bind to this ListView using a custom subclass of the ArrayAdapter class. Inside the overridden ArrayAdapter.getView(...) method, I assign an OnClickListener . In the onClick method of the OnClickListener , I want to launch a new activity. I get the exception: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? How can I get the Context that the ListView (the current Activity ) is working under? 回答1:

super.onActivityResult inside adapter class? Android

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have RecyclerView with very complex item, multiple buttons/images/texts. To access each button/image I set my click Listeners inside my Adapter class. But now I am trying add function to set contact ringtone and I have a problem. I am calling the onActivityResult method like this: Intent contactIntent = new Intent(Intent.ACTION_PICK); contactIntent.setType(ContactsContract.Contacts.CONTENT_TYPE); contactIntent.putExtra("RINGTONE_POSITION", position); ((Activity) context).startActivityForResult(contactIntent, CONTACT_CHOOSER_ACTIVITY_CODE )

Rspec tests failing randomly when analysing ActiveRecord objects generated by Mongoid events

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I implemented an activity logging mechanism based on Mongoid that saves events in MongoDB. The Mongoid model Activity has after_create events that perform different tasks depending on the type of activity logged: (Simplified example) class Activity include Mongoid::Document after_create do |activity| method_name = "after_#{activity.event_type}" send(method_name) if respond_to? method_name end def after_user_did_something MyItem.create!(:type => :user_did_something) end end The test looks like this: it 'should hide previous [objects] create a

Start the trim video activity with an intent

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I can take a video with an intent now what are the details to create an intent to start the default video trimmer activity? And check if it present on the device? 回答1: This solution relies on a version of the AOSP Gallery2 package being installed on the device. You can do it like this: // The Intent action is not yet published as a constant in the Intent class // This one is served by the com.android.gallery3d.app.TrimVideo activity // which relies on having the Gallery2 app or a compatible derivative installed Intent

Android activity over default lock screen

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How can I display an Activity or Dialog to be visible over the lock screen? I have already tried displaying my lock activity when screen turns on by setting various window type in Activity.onCreate() method: TYPE_PRIORITY_PHONE TYPE_SYSTEM_ALERT TYPE_KEYGUARD and others together with SYSTEM_ALERT_WINDOW and INTERNAL_SYSTEM_WINDOW permissions. My activity is visible after I unlock the device. UPDATE: I actually already managed to display my own Activity instead of default lock screen. It work perfectly unless you use HOME button.

Can Activity.getIntent() ever return null?

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can Activity.getIntent() ever return null ? The documentation does not mention this as a possibility, so I am wondering if I have to check the result of getIntent() for null value before dereferencing it. 回答1: Yes, it can , but only in two cases: In activity constructor: Intent set up in internal attach method, called from Instrumentation class: public Activity newActivity(Class> clazz, Context context, IBinder token, Application application, Intent intent, ActivityInfo info, CharSequence title, Activity parent, String id, Object