intent

Android power save mode listener?

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can an Android listener be created to perform a task just before entering power save mode? Also: what are some of the low power options that can be controlled by this task? 回答1: The answer above(for API 21 and above) is not exactly right. You should register a receiver in your activity or service like this: BroadcastReceiver powerSaverChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { checkPowerSaverMode(); } }; IntentFilter filter = new IntentFilter(); filter.addAction("android

Android - Build a notification, TaskStackBuilder.addParentStack not working

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to launch an activity from a notification like the Android docs explain, but when I open the notification and then press the back button, the HomeActivity (parent) doesn't open, instead the application closes. What am I doing wrong? Intent resultIntent = new Intent(context, MatchActivity.class);; resultIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(MainActivity.class)

Start activity from preference-headers

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm implementing n-layer PreferenceActivities 1st layer PreferenceActivity is loaded from preference-headers. First header creates fragment of settings which is a PreferenceFragment. Second is a browser activity (2nd is an example from developer.android.com) which opens specified Url. The third one I want to be a next level of PreferenceAtivity that also will be loaded from preference-headers. First two work fine but 3rd is crashing an app with the exception: "android.content.ActivityNotFoundException: No Activity found to handle Intent {

Denied starting an intent without a user gesture Webview Android

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Trying to redirect local html page in android webview using Javascript redirect, gets denied starting an intent in Logcat: Testing on android 5.1.1 document.location = "index.html"; Denied starting an intent without a user gesture, URI: file:///android_asset/index.html 回答1: I read the documentation in 1,000 attempts Android.developer and this was my solution I do not know if you understand, I speak Spanish webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false

send intent from service to activity

匿名 (未验证) 提交于 2019-12-03 02:22:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to return the result from an IntentSerivce to the mainactivity using an intent, but I can't get it to work. The IntentService receives the intent from the activity without a problem, does it's thing and gets a JSONstring . Now the only problem left is to send this String back to the activity. Here is the method in the mainactivity: public String RTConn(String query){ System.out.println("Querying Rotten Tomatoes."); Intent rtIntent = new Intent(MainActivity.this, RTConnection.class); rtIntent.putExtra("query", query); bindService

Getting started with ZXing on Android

匿名 (未验证) 提交于 2019-12-03 02:22:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to add ZXing to my project (add a button which calls the scanner upon press). I found this: http://groups.google.com/group/android-developers/browse_thread/thread/788eb52a765c28b5 and of course the ZXing homesite: http://code.google.com/p/zxing/ , but still couldn't figure out what to include in the project classpath to make it all work! As for now, I copied the classes in the first link to my project (with some package name changes), and it runs but crashes after pressing the button and trying to install the barcode scanner. Some

How to getCropAndSetWallpaperIntent(Uri imageUri) to work?

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: So, there are two questions that are the same as this( How to use getCropAndSetWallpaperIntent method in WallpaperManager? AND How to use getCropAndSetWallpaperIntent? ), but there are no answers to both of them. In hope of an answer I'm asking this - how to get this method to work. http://developer.android.com/reference/android/app/WallpaperManager.html#getCropAndSetWallpaperIntent(android.net.Uri) that doesn't help my brains. And this doesn't work WallpaperManager wallpaperManager = WallpaperManager . getInstance ( MainActivity .

How do I get a Phonegap app to receive variables on Android?

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With much help from the Stack OVerflow community, I now have successfully set up my Android app so that when one clicks on a link in an email, it opens my app directly. In other words, I have my <intent-filter> in my AndroidManifest.xml properly configured. So far so good, but there is one last step that I am still struggling with, which is getting my Phonegap-built app to pick up and use the variables that I pass to it from a URL in an email. The link in the email looks like this: <a target="_blank" href="https://mysite.com/confirmation

Android ServiceTestCase for IntentService

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm currently writing unit tests for an android application and stumbled into the following issue: I use the ServiceTestCase to test an IntentService like this: @Override public void setUp() throws Exception { super.setUp(); } public void testService() { Intent intent = new Intent(getSystemContext(), MyIntentService.class); super.startService(intent); assertNotNull(getService()); } However I noticed that my IntentService is created (means that onCreate is called) but I never receive a call into onHandleIntent(Intent intent) Has anyone

How do I properly fire ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent?

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As stated in the documentation: "An app holding the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission can trigger a system dialog to let the user add the app to the whitelist directly, without going to settings. The app fires a ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS Intent to trigger the dialog." Can someone tell me the proper way to fire this intent? 回答1: Intent intent = new Intent(); String packageName = context.getPackageName(); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); if (pm