android-intent

android app crash on android 4.4 due to gps permission denial

為{幸葍}努か 提交于 2019-12-30 05:01:06
问题 My android app is crashing when I try to enable GPS on my android 4.4 (Kitkat) . It's been working fine till Android 4.3 . I am using following code to turn on GPS Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); intent.putExtra("enabled", true); this.sendBroadcast(intent); In my Log Cat its giving security exception. My LogCat details are as :- 11-27 12:47:37.410: E/AndroidRuntime(3818): Caused by: java.lang.SecurityException: Permission Denial: not allowed to send

Choose folder on Android device

自古美人都是妖i 提交于 2019-12-30 04:01:17
问题 I would like to let user pick directory and save downloaded file (my app downloads file). I know that some tools (for example, ES File Explorer) provide such intent-filters. see http://www.estrongs.com/en/support/developers.html. I start activity for result and then get selected folder as a result. Also, I know that there are no "select folder" intent standards (I can't use the same intent with other tools). Do you know other tools to support such functionality ? I would like to let user use

Android - How to open google maps with Intent and KML?

冷暖自知 提交于 2019-12-30 03:30:05
问题 I need to open google maps using kml file wich already exists on sdcard. (/sdcard/example.kml) I tried: Open local KML File in Google Maps on Android this answer is wrong, when click on link, maps open, but search for location "file:///sdcard/example.kml" Using Intent: This code throws ActivityNotFoundException : Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("file:///sdcard/example.kml")); startActivity(intent); I tried use setDataAndType method, but isnt works:

Optionally starting activities and using notifications from services in Android. Only launch or notify if a certain app is present

杀马特。学长 韩版系。学妹 提交于 2019-12-30 03:27:06
问题 I have a service I am reusing (it a both a "bound" and "started" service) in my own app because it does a lot of useful data acquisition I'm interested in. Everything was working but I noticed a problem. An exception is thrown in this code: Intent dialogIntent = new Intent(); dialogIntent.setClassName(service.getBaseContext(), "com.mycompany.receiver.ui.DialogActivity"); // names changed to protect the innocent dialogIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE

Android start activity on Menu Item selection

吃可爱长大的小学妹 提交于 2019-12-30 03:09:15
问题 I have 2 classes. One will be a basic instructions screen and on that screen it will have a menu that will let you go to the other class. The other class is a MapActivity. I believe the problem is that its not finding the other class. I've tried a few different ways of declaring the intent to find the class. This is the latest thing I've tried: @Override public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mainmenu, menu); return

ListView onClickListener() does not work after adding RadioButton

一世执手 提交于 2019-12-30 03:04:53
问题 I have a ListView ( my_list.xml ): <ListView android:id="@+id/my_list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:choiceMode="singleChoice" /> The layout for each list item is ( list_item.xml ): <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" > <ImageView android

Call startActivityForResult from Fragment doesn't call onActivityResult

半城伤御伤魂 提交于 2019-12-30 01:57:05
问题 I have a DialogActivity which is called from a Fragment for show a custom Dialog with two image buttons. In DialogActivity.onCreate final Dialog dialog = new Dialog(this, R.style.DialogTheme); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_pause); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.show(); In DialogActivity.onClick @Override public void onClick(View v) { Log.d(LOGTAG, "onClick

Android Alarm Manager setExactAndAllowWhileIdle() not working in Android 7.0 Nougat in Doze mode

徘徊边缘 提交于 2019-12-30 01:51:05
问题 I am trying to make an alarm fire in my app every 30 minutes using Alarm Manager's setExactAndAllowWhileIdle but it is not working! I test the functionality by issuing a push notification whenever I receive an alarm signal. The problem is: when the device enters doze mode after being idle for sometime, I no longer receive alarms. However, as soon as I turn On the screen, I receive a notification. My app needs accurate alarms that need to be delivered exactly on-time every 30 minutes! It can

Android - matching a url pattern?

蹲街弑〆低调 提交于 2019-12-29 20:31:29
问题 I'd like one of my activities to pick up a particular url. The pattern is: http://www.example.com/abc123/foo/xyz789 The path components "abc123" and "xyz789" can be any sequence of alpha-numerics, length > 1. Doing this in my manifest: <activity> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="example.com"

Android - matching a url pattern?

て烟熏妆下的殇ゞ 提交于 2019-12-29 20:30:59
问题 I'd like one of my activities to pick up a particular url. The pattern is: http://www.example.com/abc123/foo/xyz789 The path components "abc123" and "xyz789" can be any sequence of alpha-numerics, length > 1. Doing this in my manifest: <activity> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="example.com"