This article illustrates the intent and usage of the open file of Android programming development. Share to everyone for your reference, specific as follows:
In writing file management system will be used to open a variety of different formats of the file requirements, because the
This article is an example of the Android implementation of the intent method to open various files. Share to everyone for your reference, specific as follows:
Import android.app.Activity;
Import Android.content.Intent;
Import Android.net.Uri;
Import Android.net.Uri.Builder;
Import Java.io.File;
Import android.content.Intent;
Custom
Android browser cross-Origin data theft and Intent Scheme attacks
The vulnerability we will introduce next affects self-built browsers and some other specific Android browsers in Android versions earlier than 4.4. It allows hackers to read cookie database files in sqlite for
v, int keycode, keyevent event) { if ( Equ (KeyCode, Keyevent.keycode_enter)) { openbrowser (); return true; } return false;}} ); The Openbrowser function is customized below.Gobutton This button responds to the Click event, so use Setonclicklistener (new Onclicklistener ()) to set the Onclicklistener object Listener This button, this is the Java unique mechanism, directly in the new Write a onclicklistener inherited class, overriding the OnClick fun
open the Web page and change the listener in mainactivity to:Bt1.setonclicklistener (New View.onclicklistener () { @Override public void OnClick (view view) { Intent Intent = new Intent (Intent.action_view); Intent.setdata (Uri.parse ("http://www.baidu.com")); StartActivity (
Intent mainly includes implicit intent and explicit intent. Explicit intent is usually used to start data between activities in the current application, while implicit intent is commonly used in some specific actions in the startup system, such as making phone calls or sendi
encounter a problem today, in the music app Long press A song, select Search in the pop-up menu, select the browser in the Search selection box. Normally you should open the browser and start the search using the default search engine, but now the browser search interface is not op
Prepared by: Xu jianxiang (netpirate@gmail.com)
Date: 2010/12/13
Web: http://www.anymobile.org
There are many entry points for opening a program:
Run the shell command line;
Launcher standby interface execution;
The status notification bar is running;
Desktop Shortcut running;
Call and run in software;
Run "open" after installing the software!
The code for calling the program is as follows (see COM. Android
In Android app development, you will often encounter the need to jump to the System settings page. But when you use the following code:Such asIntent Intent = new Intent (settings.action_wifi_settings);StartActivity (Intent);Instead of opening the system's WiFi settings page right now, you'll seeThis belongs to
(intent );
Implicit intent: Open the Activity of another program by specifying the package name and class name.
// Implement the jump function Intent intent = new Intent (); // sets the jump action
recorderIntent MI = new intent (media. record_sound_action );Startactivity (MI );
16. display the detailed list of applicationsUri uri = URI. parse ("Market: // details? Id = app_id ");Intent it = new intent (intent. action_view, Uri );Startactivity (it );// Where app_id is the Application ID, find the ID// By clickin
apps. After seeing this, I read the source code of their page.Here they add a data-sentintent label, see here, should be able to determine that the third-party browser should be the default does not support hair intent, only one. According to the front end, this tag should be customized. When we look at the source at the front, we find this.So the final result should be the Baidu side is a port, and then i
.
More usage of implicit Intent
Open a browser for a specified page
1. modify the code for clicking the event button in FirstActivity. The main code is as follows:
Button1.setOnClickListener (new OnClickListener () {@ Overridepublic void onClick (View v) {// TODO Auto-generated method stub/* Toast. makeText (FirstActivity. this, "you clicked butt
There are two types of intentions in android: explicit and implicit,
Explicitly requires that you know the package and class of the activated component
For implicit intent, you only need to know the actions and data of the jump activity to activate the corresponding component.
A main activity B receives the redirected activity
Procedure
1: declare B in the main configuration file at least one
intent. A intent can have multiple category, but most intent require category. Here are some public category information:
Constant
Meaning
Category_browsable
The target activity can be activated by the browser to display the data of the linked application-for example, an image
example, the browser receives an unknown MIME type data (such as a video ...), this kind of Intent will be released, and other applications of the system will be requested for help. The natural language of a table should be: viewing pdf documents. Blogger Note 3: MIME type? MIME (Multipurpose Internet Mail Extensions) multi-purpose Internet Mail Extension type is to set a file extension to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.