Android 2.1 的 intent 的 dialer 实例
2010-03-18 16:12:00 来源:WEB开发网Constant Value: 268435456 (0x10000000)
最终代码:
package com.android.AndroidPhoneDalier;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.net.Uri;
public class AndroidPhoneDalier extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent DialIntent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:88161644"));
DialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(DialIntent);
}
}
各种FlAG定义
public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT
This flag is not normally set by application code, but set for
you by the system as described in the launchMode documentation for the singleTask mode.
Constant Value: 4194304 (0x00400000)
public static final int FLAG_ACTIVITY_CLEAR_TOP
If set, and the activity being launched is already running in
the current task, then instead of launching a new instance of
that activity, all of the other activities on top of it will
be closed and this Intent will be delivered to the (now on top)
old activity as a new Intent.
For example, consider a task consisting of the activities: A, B, C, D. If D calls
startActivity() with an Intent that resolves to the component of activity B,
then C and D will be finished and B receive the given Intent, resulting in the stack now being: A, B.
The currently running instance of task B in the above example will either
receiving the new intent you are starting here in its onNewIntent()
更多精彩
赞助商链接