android-intent

Open PDF in a WebView

。_饼干妹妹 提交于 2019-12-28 02:39:05
问题 I want to open a PDF in my WebView, and I found and combined codes on this forum. But it catches the "No PDF application found" although I have multiple PDF apps installed, including Adobe Reader. Here the code: private class PsvWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); if (url.contains(".pdf")) { Uri path = Uri.parse(url); Intent pdfIntent = new Intent(Intent.ACTION_VIEW); pdfIntent.setDataAndType

Auto start application after boot completed in Android

試著忘記壹切 提交于 2019-12-28 02:06:11
问题 I want to make an application which has auto start option in its settings. I have made Settings activity in my application which is derived from PreferenceActivity and give CheckBoxPreference for auto start option. If auto start option is enabled my application should start when booting of phone is completed. And if auto start option is disabled then it should not start on boot completed. To achieve this I have implemented derived class of BroadcastReceiver which receives BOOT_COMPLETED

Auto start application after boot completed in Android

隐身守侯 提交于 2019-12-28 02:05:53
问题 I want to make an application which has auto start option in its settings. I have made Settings activity in my application which is derived from PreferenceActivity and give CheckBoxPreference for auto start option. If auto start option is enabled my application should start when booting of phone is completed. And if auto start option is disabled then it should not start on boot completed. To achieve this I have implemented derived class of BroadcastReceiver which receives BOOT_COMPLETED

Android - How to intercept the 'Install application' intent

北战南征 提交于 2019-12-28 01:55:23
问题 OK, so not entirely sure this is possible... But trying to write an application so that I can run some code before any of the following activities are performed. 1) APK is downloaded from web and market launches installer 2) Install button is pressed on android market Is it possible to intercept and prompt on these events, or has Google locked that stuff down quite tightly? 回答1: This isn't an answer per se, but I can't find any commenting tool here. Sorry. I'm having this issue as well. I

Open gallery app from Android Intent

跟風遠走 提交于 2019-12-27 22:51:12
问题 I'm looking for a way to open the Android gallery application from an intent. I do not want to return a picture, but rather just open the gallery to allow the user to use it as if they selected it from the launcher ( View pictures/folders ). I have tried to do the following: Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); However this is causing the

Start a fragment via Intent within a Fragment

两盒软妹~` 提交于 2019-12-27 20:11:33
问题 I want to launch a new fragment to view some data. Currently, I have a main activity that has a bunch of actionbar tabs, each of which is a fragment. So, within a tab fragment, I have a button, chartsButton. I have my onclicklistener all set for it, and here's the onClick method: public OnClickListener chartsListener = new OnClickListener() { @Override public void onClick(View v) { Intent chartFragment = new Intent(); startActivity(chartFragment); } }; Now, as I said, this listener is within

Start a fragment via Intent within a Fragment

时光总嘲笑我的痴心妄想 提交于 2019-12-27 20:08:05
问题 I want to launch a new fragment to view some data. Currently, I have a main activity that has a bunch of actionbar tabs, each of which is a fragment. So, within a tab fragment, I have a button, chartsButton. I have my onclicklistener all set for it, and here's the onClick method: public OnClickListener chartsListener = new OnClickListener() { @Override public void onClick(View v) { Intent chartFragment = new Intent(); startActivity(chartFragment); } }; Now, as I said, this listener is within

Gmail 5.0 app fails with “Permission denied for the attachment” when it receives ACTION_SEND intent

假如想象 提交于 2019-12-27 14:42:33
问题 My app creates mails with attachments, and uses an intent with Intent.ACTION_SEND to launch a mail app. It works with all the mail apps I tested with, except for the new Gmail 5.0 (it works with Gmail 4.9), where the mail opens without attachment, showing the error: "Permission denied for the attachment". There are no useful messages from Gmail on logcat. I only tested Gmail 5.0 on Android KitKat, but on multiple devices. I create the file for the attachment like this: String fileName = "file

Broadcast Receiver Register in Manifest vs. Activity

旧巷老猫 提交于 2019-12-27 13:35:14
问题 I need some help to understand when I can expect my broadcast receiver will work when just registered in the manifest versus having to be registered from a running activity or service. So for example if I register a stand alone receiver with the following intent filter it works without having a service/activity reference to it: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.blk_burn.standalonereceiver" android

Integer cannot be cast to java.util.HashMap

浪子不回头ぞ 提交于 2019-12-27 06:38:46
问题 Im using listview on android, below code is giving error after clicking on a list item for another new activity @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting list view size int size = parent.getCount(); // initializing array according to list view size String[] all_pid = new String[size]; String[] all_name = new String[size]; String[] all_address = new String[size]; String[] all_latitude = new String[size]; String[] all_longitude = new