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:
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")) {
更多精彩
赞助商链接