WEB开发网
开发学院手机开发Android 开发 Android隐性Intent的例子 阅读

Android隐性Intent的例子

 2010-11-05 00:56:46 来源:WEB开发网   
核心提示:Uri mapUri = Uri.parse("geo:39.906033,116.397700");Intent i = new Intent(mapSearchIntent, mapUri);i.setData(mapUri);startActivity(i);}}然后是要跳转的Activity

Uri mapUri = Uri.parse("geo:39.906033,116.397700");

Intent i = new Intent(mapSearchIntent, mapUri);

i.setData(mapUri);

startActivity(i);

}

}

然后是要跳转的Activity:

Java代码

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

/**

* @author Tony Shen

*

*/

public class SecondActivity extends Activity{

private Uri data;

private String action;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

Intent intent = getIntent();

if (intent.getAction() != null)

action = intent.getAction();

if (intent.getData()!=null)

data = intent.getData();

if (action.equals("com.decarta.mapsearch.intent.action.SEARCH")) {

Intent i = new Intent(Intent.ACTION_VIEW, data);

startActivity(i);

}

}

}

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

/**

* @author Tony Shen

*

*/

public class SecondActivity extends Activity{

private Uri data;

private String action;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

Intent intent = getIntent();

if (intent.getAction() != null)

action = intent.getAction();

if (intent.getData()!=null)

data = intent.getData();

if (action.equals("com.decarta.mapsearch.intent.action.SEARCH")) {

Tags:Android 隐性 Intent

编辑录入:coldstar [复制链接] [打 印]
赞助商链接