天道酬勤,学无止境

android-intent

TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA 的 IntentNotFoundException(IntentNotFoundException for TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA)

问题 我正在尝试按照 Android 开发人员博客上的这篇文章来实现文本到语音。 如果不支持,它建议使用以下代码安装文本到语音数据。 Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); 这会引发Exception : ActivityNotFoundException : 没有找到处理意图的活动 但是,我使用此处的代码来确定实际支持的意图。 这是列表表示: [ResolveInfo{43cc5280 com.svox.pico.DownloadVoiceData p=0 o=0 m=0x108000}] 为什么这不起作用? 更新 我不知道为什么,但现在似乎可以了。 回答1 要检查是否实际支持该意图,请使用以下代码: PackageManager pm = getPackageManager(); Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); ResolveInfo resolveInfo = pm

2021-06-21 10:56:31    分类:技术分享    android   android-intent

需要在卸载 Android 应用程序期间执行一些活动(Need to perform some activity during the unistallation of an Android app)

问题 如果用户卸载该应用程序,我正在开发一个需要登录的应用程序。 所以我遵循这种方法应用程序如何检测它将被卸载? 但我面临与这篇文章相同的问题卸载应用程序时无法获取接收器。 由于我的手机是 Android 4.4 ......任何人都可以发布确切的解决方案(代码)来解决这个问题??? 编辑:在卸载期间 QUERY_PACKAGE_RESTART 意图应该被广播,但我没有收到它。 我也在清单中声明了它,我创建了一个广播接收器,它正在监听这个意图......我的方法与卸载应用程序时无法获取接收器完全相同。 我没有收到意图。 该怎么办?

2021-06-21 10:04:00    分类:技术分享    android   android-intent   broadcastreceiver

adb shell dumpsys activity activities shows two instances of single task in separate stack

I have a main activity having intent with CATEGORY_HOME to behave like a launcher. It also has CATEGORY_LAUNCHER so that user can access from App Drawer. Here is the main activity: public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onResume() { super.onResume(); } @Override protected void onDestroy() { super.onDestroy(); } } I have another activity containing a button to call the MainActivity with HOME intent. It is another

2021-06-21 08:53:20    分类:问答    android   android-intent   android-launcher   android-homebutton

BroadcastReceiver how to start new intent

I implemented a broadcast receiver to "block" my app if the internet connection is lost. By block I mean that the app has to open a "No internet connection" activity. this is my receiver code: public class ConnectivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); Log.d("** Debug **","noConnectivity " + noConnectivity); if(noConnectivity){ //SHOW NO INTERNET CONNECTION ACTIVITY } } } Is it possibile to start NoInternetConnection.class when

2021-06-15 15:44:54    分类:问答    android   android-intent   broadcastreceiver

Open URL in browser even though my app registered an intent-filter for it

My app registers an intent filter for certain URLs because it can handle the data from those URLs. However, inside the app I would like to provide a button to open such an URL in the browser. That is, open it in the default browser if one is set, otherwise provide a chooser - just like normal. Now when my app is set as default for those URLs and I press the button, naturally I just get the same activity in my app again and again and again. Any ideas?

2021-06-15 14:49:09    分类:问答    android   android-intent   intentfilter

Launch Activity From URL

I am trying to have my application launch when the user browses to a certain url. I have found a few examples and they all have the same things in the manifests but it's not working for me. I have put the intent-filter under an Activity as well as a Receiver. Here is my manifest snippet: <intent-filter> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:host="www.urbandictionary.com" android:scheme="http"></data> </intent-filter>

2021-06-15 14:09:29    分类:问答    android   android-intent   android-activity   manifest

How to show the “internal storage” option in an ActionOpenDocument intent by default

I need the user to select a file of a custom filetype that they've dragged onto their android device from windows file explorer, but the internal storage option isn't available by default. When I launch the intent using this: var libraryIntent = new Intent(Intent.ActionOpenDocument); libraryIntent.SetType("application/*"); _activity.StartActivityForResult(libraryIntent, (int)ActivityRequestCode.ImportFeatureCodeLibrary); Android OS (5.1 and 6.0) shows the following screen: The user has to know to go to the button in the top right and select the option to show internal file storage: They have

2021-06-15 14:00:02    分类:问答    android   android-intent   xamarin.android

Android App Development - Send email directly with no Intents

Can anyone suggest how I can send an email without using intents or opening another android app. I want the email to be sent directly once I hit the send button. I must use a specific office365 email for sending message. Should I use some API or SMTP etc.? Is there a simple way on how I can apply this feature on my android app?

2021-06-15 11:56:38    分类:问答    android   email   android-intent   smtp

how to start a new activity after login success?

i want to start a new activity after login success. that is when login goes correct a new activity should start automatically...i dont know where to mention startactivity. please help me with this, im a newbie to android. this is my code... public class BackgroundTask extends AsyncTask<String,Void,String> { AlertDialog alertDialog; Context ctx; BackgroundTask(Context ctx) { this.ctx =ctx; } @Override protected void onPreExecute() { alertDialog = new AlertDialog.Builder(ctx).create(); alertDialog.setTitle("Login Information...."); } @Override protected String doInBackground(String... params) {

2021-06-15 11:48:06    分类:问答    android   android-intent   android-activity

How to properly clear intent data from singleTop Activity?

Scenario is: Activity with singleTop declared at the manifest. This activity is called with some extras. I'm able to clear the intent data and be able to flip screen and such without the original intent being called... The issue is that when the activity is killed by the system and the user goes back to this activity it gets restarted using the original intent used to create the activity. How do I remove this? I tried starting the same activity from within with a new Intent but no luck... I have also used various flags.

2021-06-15 11:42:25    分类:问答    android   android-intent