android-intent

Can someone please explain to me the basic function of Intents in the Android OS?

烂漫一生 提交于 2020-01-01 03:51:43
问题 I'm new to programming applications for the Android OS. As far as general architecture of the OS goes, I understand that processes are implemented as Linux processes and that each one is sandboxed. However, I'm utterly confused on the IPCs and syscalls (if any) used. I know that the IBinder is a form of this; parcels are sent back and forth between processes and Bundles are array forms of parcels (?). But even that is still unfamiliar to me. Same with Intents. All in all, I don't understand

Use DownloadManager class to download file from WebView

有些话、适合烂在心里 提交于 2020-01-01 03:40:09
问题 I have this little code here when click a link on webview that is a link to a file, in this case .mp4. this code will go to default web browser and request app that can view this file type. myWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); What i want is when i click that

Airplane Mode Receiver in Manifest?

爷,独闯天下 提交于 2020-01-01 03:29:07
问题 I am working on developing an Android app that will be used as a handheld controller in an industrial environment. In order to make the tablet less desirable to take home, I was going to try and programatically turn on Airplane Mode all the time but that was deprecated in 4.2, which is also the version we are using in order to have Android Open Accessory. However I was thinking that if I could register a receiver within the manifest such that it will launch my app anytime Airplane Mode is

Launch app with URL

十年热恋 提交于 2020-01-01 03:20:28
问题 I've read about intents in android but here goes my question. I'd like to launch an app on my android phone with the click of a link in the web browser. Example: If the link is "mycam://http://camcorder.com", "mycam://" acts as some kind of "tag" to launch my app but I'd like to pass "http://camcorder.com" as a string to that app on start. Help please! Thanks! 回答1: there is a method in the Browser app source code, : public boolean shouldOverrideUrlLoading(WebView view, String url) { ... }

How to get selected text from edittext in android?

江枫思渺然 提交于 2020-01-01 02:41:33
问题 I have a edittext in which some text are selected . I want to get only selected text from edittext on click of button . Please suggest me usable link or sample code. 回答1: EditText et=(EditText)findViewById(R.id.edit); int startSelection=et.getSelectionStart(); int endSelection=et.getSelectionEnd(); String selectedText = et.getText().toString().substring(startSelection, endSelection); 回答2: getSelectionStart() getSelectionEnd() see this link 来源: https://stackoverflow.com/questions/10070762/how

Transfer Socket from one Activity to another

二次信任 提交于 2020-01-01 02:33:07
问题 I am trying to transfer Socket attribute from one Activity to another but i can not use Intent.putExtra() method. socket = new Socket("10.0.0.9", port); i = new Intent(getBaseContext(), MainActivity.class); i.putExtra("mysocket", socket); How i can transfer Socket from one Activity to another? 回答1: You can't 'pass a Socket' from one Activity to another, but you do have other options. Option 1 . Create a class with a static reference to your Socket and access it that way. In your first

How to use putExtra() with FLAG_ACTIVITY_REORDER_TO_FRONT in Android Apps?

可紊 提交于 2020-01-01 01:52:32
问题 I have an application, call "App1". In my App1 I invoke Camera application. intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("com.android.camera","com.android.camera.Camera")); startActivity(intent); After that, I use FileObserver to listen whether user take a photo. When this happens I call Context ctx = App1.this.getApplicationContext(); Intent j = new Intent(ctx, App1.class); j.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); j.putExtra("type", 1);

Facebook deep linking on Android

早过忘川 提交于 2020-01-01 01:15:09
问题 I'm trying to implement Facebook's Deep Linking feature on my app and encountered the following scenario: I have an activity called MainActivity which is declared like so: <activity android:name="com.mypackage.android.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> This activity + my package name are also declared in my app's settings on facebook developer website.

Launch Mx Player through intent

[亡魂溺海] 提交于 2020-01-01 00:48:33
问题 here is my code to call mxplayer but it didn't work, why ? Intent myIntent ; PackageManager manager = getPackageManager(); myIntent = manager.getLaunchIntentForPackage("com.mxtech.videoplayer.ad"); startActivity(myIntent); 回答1: The developer of MX Player documented its package namespaces here: https://sites.google.com/site/mxvpen/api So if you have installed the pro version, you need to use another name. [Package] com.mxtech.videoplayer.pro - Pro Edition com.mxtech.videoplayer.ad - Free

Intent-Filter for Whatsapp -> share image

浪尽此生 提交于 2020-01-01 00:46:10
问题 If you try to share an Image with Whatsapp, it will give you a list where you can choose: like Camera,Gallery etc. now i would like to place my app in this list. I Saw some apps like "paint for whatsapp" where this was possible. I tried "android.media.action.IMAGE_CAPTURE" but this only replaces the System-Camera. I want to have a new point in the List. Thanks in advance Jonas 回答1: This works for me: <intent-filter> <action android:name="android.intent.action.PICK" /> <category android:name=