android-intent

Flag Activity Clear Top destroys target activity and than creating it

给你一囗甜甜゛ 提交于 2020-01-02 03:12:28
问题 I am watching a behavior of Intent.FLAG_ACTIVITY_CLEAR_TOP. For example i have three activities A,B and C Now Flow is A -> B -> C Now when i am starting A from C with this flag with following code. Intent intent_to_a=new Intent(C.this,A.class); intent_to_home.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent_to_a); AFAIK, Intent.FLAG_ACTIVITY_CLEAR_TOP should remove B and should resume the A .It also does the same but in a strange way. It removes B , than removes A than creates A

Specifying a SEND (sharing) intent filter for a Service

六眼飞鱼酱① 提交于 2020-01-02 02:28:10
问题 I am trying to filter and handle intents with android.intent.action.SEND actions in one of my Service s. I wrote the following in my AndroidManifest.xml : <service android:name=".app.ScreamerService" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.SEND"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="*/*"/> </intent-filter> </service> Now, the problem is that I don't see my application in the list of "share

How to restrict Google drive option from not appearing while selecting file or image in Android below API level 19?

谁说我不能喝 提交于 2020-01-02 02:24:07
问题 I am newbie in Android and I have a requirement for selecting files on devices below API level 19. I have tried private void chooseFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { intent.setType("application/pdf|file"); } else { intent.setType("image/*|application/pdf"); } startActivityForResult(intent, PICKFILE_REQUEST_CODE); } Now I do not want Google drive to appear as an option and I want file-manager as an option.

Difference between putExtra() and setData()

放肆的年华 提交于 2020-01-02 01:16:10
问题 What is the difference between putExtra() and setData()? I have read the android docs but it is of not much help. Also there is a previous question Intent.setData vs Intent.putExtra but it is still not clear. Thanks in advance. 回答1: setData() Set the data this intent is operating on. This method automatically clears any type that was previously set by setType(String) or setTypeAndNormalize(String). Note : scheme matching in the Android framework is case-sensitive, unlike the formal RFC. As a

Keeping alive Intent Service after application is killed

。_饼干妹妹 提交于 2020-01-02 01:15:10
问题 I have intent service in my app. This service has some job to do - uploading some files. It runs only when there is something to do. Service won't upload when some conditions are met, for example no Internet connection. For that reason it registers itself to on broadcast receiver to receive message about Internet connection changes. The problem is that service is killed with app even if it is doing something, for example: App is sending intent to service Service started uploading something,

Not allowed to start service Intent X without permission Y

天大地大妈咪最大 提交于 2020-01-02 01:12:12
问题 04-25 14:16:30.931: E/AndroidRuntime(6638): FATAL EXCEPTION: main 04-25 14:16:30.931: E/AndroidRuntime(6638): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.exclusive26.igale/com.exclusive26.igale.Push_Activity}: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) } without permission com.google

Resume old activity by passing new data in bundle

风流意气都作罢 提交于 2020-01-02 01:04:06
问题 I have couple of activities say A , B, C. Activity A starts B , B starts C and so on. In my app I have put a navigation drawer which allows users to go back to activity A. When user goes back to activity A I have passed some flags which don't actually restart the activity but just resumes it. intent = new Intent(activity, A.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); Now I m trying to pass some data using bundles. bundle.putInt("selectedTab",

Intent.ACTION_PICK returns empty cursor for some contacts

谁都会走 提交于 2020-01-02 00:55:15
问题 I have an app in which one aspect is for a user to select a contact and send a text to that contact thru the app. The app only works with some contacts and fails on others. More precisely: for the contacts that I entered into my contact book by hand, the Intent.ACTION_PICK has no trouble finding and returning them to the app, i.e. cursor.moveToFirst() is true. But for the contact that were imported by Facebook (my phone is set to sync with Facebook contacts), I get the following android

How to start one activity from Customized View

只谈情不闲聊 提交于 2020-01-02 00:52:24
问题 How to start one activity from another View (another activity View) For example, public class CorrectSmoothGloflo extends Activity { ....................... setContentView(new Panel(this)); } public class Panel extends View { //This view class contains some drawable operation // Here i want to start another Activity like this Intent i=new Intent(CorrectSmoothGloflo.this,Screen.class); startActivity(i); } I cant do this operation. Because this is the View, that will not work, because View does

How to get the file name from the intent?

烈酒焚心 提交于 2020-01-02 00:47:33
问题 This is my manifest file. After using intent filter i download the ics file from the mail attachment. When i open the downloaded file it start my application. I need to get the file name and data of the selected file in my application. What should i do in the manifest and the java file. I am very new to android can any one help me???? <application android:label="@string/app_name" android:icon="@drawable/icsicon"> <activity android:name=".setMIMEfile" android:label="@string/app_name"> <intent