intent

Get IntentSender object for createChooser method in Android

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to use new version of Intent.createChooser method which uses IntentSender . Documentation states only that I can grab it from PendingIntent instance. In my case it seems that PendingIntent won't have any other use. Is there another way to obtain IntentSender or do I need create PendingIntent ? 回答1: the chooser target intent is not the PendingIntent . For instance, in the following snippet, I am declaring intent for ACTION_SEND , with type text/plain , and this is the my target intent for the Intent.createChooser . Then I am

How to get installed applications in Android and no system apps?

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I want to get all application which appears in the menu screen. But, now I only get the user installed apps or all the application (included the system application). My current code is: final PackageManager pm = getActivity (). getPackageManager (); List apps = pm . getInstalledPackages ( PackageManager . GET_META_DATA ); ArrayList aux = new ArrayList (); for ( int i = 0 ; i < apps . size (); i ++) { if ( apps . get ( i ). versionName != null && (( apps . get ( i ). applicationInfo . flags & ApplicationInfo . FLAG_SYSTEM ) != 1 ))

how to make intent.setType for pdf,xlsx and txt file android?

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to choose only pdf, xlsx and txt file from storage but intent.setType can do only one file(eg.txt file only (or) pdf file only). Is it possible to get all three files by coding intent.setType() and Is there a way to do? Here is some of my code. private void showFileChooser() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("application/pdf"); intent.addCategory(Intent.CATEGORY_OPENABLE); try { startActivityForResult( Intent.createChooser(intent, "Select txt file"), 0); } catch (android.content

call activity method from broadcast receiver

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In the main activity, a layout is loaded that has some input fields and a submit button. When the submit button is clicked, the onClick handler method sends an sms back to the same mobile number : SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(number, null, "hi", null, null); There is a broadcast receiver defined that intercepts the message : public class SmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle pdusBundle = intent.getExtras(); Object[] pdus=(Object[]

Error broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.flagg327.guicomaipu (has extras) }

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm receiving that error from Android Studio's Android Monitor. This error appears when I send a push notification through GCM, in a real device, and the app has not been started yet or has been forced to stop. Yesterday all works fine, today is not working at all (works only if the app is running in background or foreground). I think this may be an AndroidManifest error, but I'm tired of looking for the problem and can not find anything. Manifest ... ... TokenRefreshListenerService.java The registration 'tokens' updates every day. It

Android Intent.ACTION_CALL, Uri

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use the Intent.Action class. I know how to use the ACTION_VIEW to display a URL but I wanted to use the Intent.ACTION_DIAL to call number when the application is launched. The documentation says you need to parse a URI into a string and then add it to the Intent I tried this: Uri call = Uri.parse("7777777777"); Intent surf = new Intent(Intent.ACTION_DIAL, call); startActivity(surf); This doesn't work I get an error message saying: Unfortunately, Project has stopped. I tried to debug the code and it seems to point me to the

Unable to start service Intent: not found

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've the same issue described here but i can't understand whats wrong. My issue is: Unable to start service Intent { act=.connections.MoodyService } U=0: not found EDIT I've changed my package from connections to service in the source code, sorry for the confusion My manifest ` service is the package and MoodyService is the class name My service class public class MoodyService extends Service { public MoodyService() { // TODO Auto-generated constructor stub } private boolean isRunning = false; Object getContent; @Override public IBinder

Which Intent for Settings - Data usage

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I spent several hours by searching correct Intent for launching Data usage Activity in Android Settings. Unfortunetly i found nothing (on web and also here). I also tried reflection (in a case of private field) but also without result. I will be glad for any help. Thanks in advance. 回答1: Try... Intent intent = new Intent (); intent . setComponent ( new ComponentName ( "com.android.settings" , "com.android.settings.Settings$DataUsageSummaryActivity" )); startActivity ( intent ); This worked for me. I found it from the link to data

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

Cannot pass custom Object in an Intent: The Method Put Extra is Ambiguous for the type Intent

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: If I try to write Car myCarObject = getCar (); Intent details = new Intent ( Start . this , DetailsCar . class ); details . putExtra ( "Car" , myCarObject ); startActivity ( details ); Eclipse show me a compilation error "The Method Put Extra is Ambiguous for the type Intent" in the line details . putExtra ( "Car" , myCarObject ); If I use the code Car myCarObject = getCar (); ArrayList parcelableExtra = new ArrayList (); parcelableExtra . add ( myCarObject ); Intent details = new Intent ( Start . this , DetailsCar . class );