intent

Getting Permission Denial Exception

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have an activity in my app that allows the user to select several files from the device one by one, I am using an intent like this: Intent intent = new Intent (); intent . setType ( "*/*" ); intent . setAction ( Intent . ACTION_GET_CONTENT ); startActivityForResult ( Intent . createChooser ( intent , getString ( R . string . select_attachments_activity_chooser_label )), SELECT_PICTURE ); This is working perfectly fine, I am getting the Uri's of the files selected, they look like this: content : //com.android.providers.media

Android: How do I avoid starting activity which is already in stack?

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Lets try to explain my question: I got an application and a service. The application is started with activity A. The service sends a broadcast that will let the application start Activity B Now the user starts activity C. Now the service wants to start activity B again. But how do I let him know that the activity is still on the stack, or is there an intent flag for this? How do I avoid that it will launch activity B because its already in the stack? 回答1: I think you need to make your activity B singleInstance that if it's already create you

How to Schedule Notification in Android [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: How to schedule a task using Alarm Manager 4 answers I'm trying to set notification for a time in the future. I have the code for creating a notification but I can't find an option to schedule it. How can I schedule notifications? 回答1: You need to use PendingIntent and BroadCastReceiver for this - public void scheduleNotification(Context context, long delay, int notificationId) {//delay is after how much time(in millis) from current time you want to schedule the notification NotificationCompat

No Activity found to handle Intent com.android.camera.action.CROP

匿名 (未验证) 提交于 2019-12-03 02:43:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to do a picture from my application. I can launch the camera and do the picture, but when has finish to do the picture my app crash. I can see in my screen that my Galery is stopped and this is the error in my log: I've tried to find something but any help me. Thanks in advance FATAL EXCEPTION: main android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.camera.action.CROP dat=file:///data/data/com.android.gallery3d/files/crop-temp (has extras) } at android.app.Instrumentation

How can i add another button intent beside previous one?

匿名 (未验证) 提交于 2019-12-03 02:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Here is my code: it contains a button named as button1A and when I click on it, It opens a list named as list1 . How can I put a code for my another button named as button2A which open a list as List2. import android . os . Bundle ; import android . app . Activity ; import android . content . Intent ; import android . view . View ; import android . view . View . OnClickListener ; import android . widget . Button ; public class Tab_1st extends Activity { Button button1A ; @Override public void onCreate ( Bundle savedInstanceState )

How to start new intent after search-filtering listview?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi guys I have a question: I created a listview, with search-bar etc . So when I click on an item (through switch-case) the selected new activity opens and there are no problems. you can see the code here: Filtered list item opens the original list items' activity The problems start when I filter the listview, with the search-bar, and instead of opening the selected activity (let us say activity 10), it throws me back to activity 1 and so forth. What I have figured out so far is that most probably the CustomAdapter somehow mixes my

How can i add another button intent beside previous one?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Here is my code: it contains a button named as button1A and when I click on it, It opens a list named as list1 . How can I put a code for my another button named as button2A which open a list as List2. import android . os . Bundle ; import android . app . Activity ; import android . content . Intent ; import android . view . View ; import android . view . View . OnClickListener ; import android . widget . Button ; public class Tab_1st extends Activity { Button button1A ; @Override public void onCreate ( Bundle savedInstanceState )

App crashes when loading image from gallery

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my app ,i have two buttons ,one for loading the image from gallery(from device )and another one for taking pictures by accesing the camera of the device,My code is working properly on some devices ,bt in some devices ,the app crashes when clicking an image in the gallery.Can anybody help me to find out the actual propblem?? public class MainActivity extends ActionBarActivity { private static int RESULT_LOAD_IMAGE = 1; private static final int CAMERA_REQUEST = 1888; private ImageView imageView; @Override protected void onCreate(Bundle

Intent.ACTION_PICK behaves differently

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using following code to pick an image from the gallery. When I test it with Samsung Galaxy S4, it directly goes to Gallery that is what I want actually. BUT, when I test my code on LG Optimus II device, it shows a dialog gives an option to choose either Gallery or Picture. In other words, it adds one more layer which I do not want. Both devices have KitKat 4.4.2 operating system. public static void showFileChooser(Activity activity) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK); activity

Syntax error on token “}”, delete this token

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I keep getting this error saying "Syntax error on token "}", delete this token." on the last line, why? I have searching for the error but I can't seem to find it. As you can see it's a service, calling on another service every once in a while. package com.iggeman.updater; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class UpdaterService extends Service { private static final String TAG = UpdaterService.class .getSimpleName(); private Updater updater; public boolean