本文整理汇总了C#中Android.Content.Intent.SetFlags方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.SetFlags方法的具体用法?C# Intent.SetFlags怎么用?C# Intent.SetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.SetFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenModal
public void OpenModal(string key)
{
var activityType = _pageKeys[key];
var intent = new Intent(Application.Context, activityType);
intent.SetFlags(ActivityFlags.NoHistory);
intent.SetFlags (ActivityFlags.NewTask);
Application.Context.StartActivity(intent);
}
示例2: ShareOnService
private void ShareOnService(string status, string title = "", string link = "")
{
var intent = new Intent(global::Android.Content.Intent.ActionSend);
intent.PutExtra(global::Android.Content.Intent.ExtraText, String.Format("{0} - {1}",status ?? string.Empty,link ?? string.Empty));
intent.PutExtra(global::Android.Content.Intent.ExtraSubject, title ?? string.Empty);
intent.SetType("text/plain");
intent.SetFlags(ActivityFlags.ClearTop);
intent.SetFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(intent);
}
示例3: SendSms
public void SendSms(string body, string phoneNumber)
{
var smsUri = Android.Net.Uri.Parse("smsto:" + phoneNumber);
var smsIntent = new Intent(Intent.ActionSendto, smsUri);
smsIntent.PutExtra("sms_body", body);
smsIntent.PutExtra(Intent.ExtraText, body);
//these flags are required when using application context
smsIntent.SetFlags(ActivityFlags.ClearTop);
smsIntent.SetFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(smsIntent);
}
示例4: ShareUrl
public async Task ShareUrl(string url, string title = null, string subject = null)
{
var intent = new Intent(Intent.ActionSend);
intent.SetType("text/plain");
intent.PutExtra(Intent.ExtraText, url);
intent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);
intent.SetFlags(ActivityFlags.ClearTop);
intent.SetFlags(ActivityFlags.NewTask);
var chooserIntent = Intent.CreateChooser(intent, title ?? string.Empty);
Android.App.Application.Context.StartActivity(chooserIntent);
}
示例5: TryIntent
private bool TryIntent(Intent intent)
{
try
{
intent.SetFlags(ActivityFlags.ClearTop);
intent.SetFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(intent);
return true;
}
catch(ActivityNotFoundException)
{
return false;
}
}
示例6: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate {
button.Text = string.Format("{0} clicks!", count++); };
var file = fileFromAsset(this, "test.pdf");
//var uri = Android.Net.Uri.FromFile(new File("file:///android_asset/test.pdf"));
var uri = Android.Net.Uri.Parse(file.AbsolutePath);
var intent = new Intent (this, typeof (MuPDFActivity));
intent.SetFlags (ActivityFlags.NoHistory);
intent.SetAction (Intent.ActionView);
intent.SetData(uri);
this.StartActivity(intent);
}
示例7: EnableVoiceSynthesisEngine
public void EnableVoiceSynthesisEngine()
{
Intent intent = new Intent();
intent.SetAction("com.android.settings.TTS_SETTINGS");
intent.SetFlags(ActivityFlags.NewTask);
CurrentActivity.StartActivity(intent);
}
示例8: OnBackPressed
public override void OnBackPressed()
{
intent = new Intent(this, typeof(SetUpActivity));
intent.PutExtra("content", SetUpActivity.TERMINATE);
intent.SetFlags(ActivityFlags.ClearTop);
StartActivity(intent);
}
示例9: OnListItemClick
protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id)
{
var intent = new Intent(this, typeof (GameActivity));
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop);
intent.PutExtra("Type", sampleTypes[position].AssemblyQualifiedName);
StartActivity(intent);
}
示例10: onCallStateChanged
public void onCallStateChanged(string state, string incomingNumber, Context _context)
{
// TODO React to incoming call. // React to incoming call. string number=incomingNumber;
//screen =_Context.FindViewById<ViewGroup>(Resource.Id.IncomingCall);
// If phone ringing
if(state == TelephonyManager.ExtraStateRinging )
{
/*var i = new Intent(_context, typeof (PlayerSevise));
i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.PlayCommand);
_context.StartService (i);*/
var i = new Intent(_context, typeof (CallActivity));
i.SetFlags (ActivityFlags.NewTask);
_context.StartActivity (i);
//Toast.MakeText(this, " Phone Is Riging ", ToastLength.Long).Show()
//Toast.MakeText(_context,"phone is neither ringing nor in a call", ToastLength.Long).Show();
}
if (state == TelephonyManager.ExtraStateIdle) {
/*var i = new Intent(_context, typeof (PlayerSevise));
i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
_context.StartService (i);*/
}
if (state == TelephonyManager.ExtraStateOffhook) {
/*var i = new Intent(_context, typeof (PlayerSevise));
i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
_context.StartService (i);*/
}
}
示例11: OpenGallery
public static void OpenGallery(Context context)
{
Intent intent = new Intent(Intent.ActionView);
intent.SetType("image/*");
intent.SetFlags(ActivityFlags.NewTask);
context.StartActivity(intent);
}
示例12: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Create your application here
SetContentView (Resource.Layout.QuestionnaireSummary);
int Ergebnis = Intent.GetIntExtra ("ergebnis", 0);
TextView ErgebnisText = FindViewById<TextView> (Resource.Id.textView3);
ErgebnisText.Text = string.Format ("{0} {1}", Resources.GetText (Resource.String.total_score), Ergebnis);
Button ContinueHome = FindViewById<Button> (Resource.Id.button1);
ContinueHome.Click += delegate {
//create an intent to go to the next screen
Intent intent = new Intent(this, typeof(Home));
intent.SetFlags(ActivityFlags.ClearTop); //remove the history and go back to home screen
StartActivity(intent);
};
//Toast.MakeText (this, string.Format ("{0}", DateTime.Now.ToString("dd.MM.yy HH:mm")), ToastLength.Short).Show();
ContentValues insertValues = new ContentValues();
insertValues.Put("date_time", DateTime.Now.ToString("dd.MM.yy HH:mm"));
insertValues.Put("ergebnis", Ergebnis);
dbRUOK = new RUOKDatabase(this);
dbRUOK.WritableDatabase.Insert ("RUOKData", null, insertValues);
//The following two function were used to understand the usage of SQLite. They are not needed anymore and I just keep them in case I wanna later look back at them.
//InitializeSQLite3(Ergebnis);
//ReadOutDB ();
}
示例13: Show
public void Show()
{
Intent intent = new Intent(Intent.ActionView);
intent.SetData(Android.Net.Uri.Parse(Uri.OriginalString));
intent.SetFlags(ActivityFlags.NewTask);
Application.Context.StartActivity(intent);
}
示例14: SetHeader
public void SetHeader(String title, bool btnHomeVisible, bool btnFeedbackVisible)
{
ViewStub stub = (ViewStub) FindViewById(Resource .Id .vsHeader);
View inflated = stub.Inflate();
TextView txtTitle = (TextView) inflated.FindViewById(Resource.Id.txtHeading );
txtTitle.Text=title;
Button btnHome = (Button) inflated.FindViewById(Resource .Id.btnHome );
if(!btnHomeVisible)
btnHome.Visibility = Android.Views .ViewStates .Invisible ;
btnHome .Click+= delegate(object sender, EventArgs e) {
Intent intent = new Intent(this.ApplicationContext , typeof (HomeActivity ));
intent.SetFlags (ActivityFlags.ClearTop );
StartActivity(intent);
};
Button btnFeedback = (Button) inflated.FindViewById( Resource.Id.btnFeedback);
if(!btnFeedbackVisible)
btnFeedback.Visibility = Android.Views .ViewStates .Invisible ;
btnFeedback .Click += delegate(object sender, EventArgs e) {
Intent intent = new Intent(this.ApplicationContext , typeof (ActivityFeedback));
intent.SetFlags (ActivityFlags.ClearTop );
StartActivity(intent);
};
}
示例15: DidEnterRegion
public void DidEnterRegion(AltBeaconOrg.BoundBeacon.Region region)
{
// In this example, this class sends a notification to the user whenever a Beacon
// matching a Region (defined above) are first seen.
Log.Debug(TAG, "did enter region.");
if (!haveDetectedBeaconsSinceBoot)
{
Log.Debug(TAG, "auto launching MonitoringActivity");
// The very first time since boot that we detect an beacon, we launch the
// MainActivity
var intent = new Intent(this, typeof(MainActivity));
intent.SetFlags(ActivityFlags.NewTask);
// Important: make sure to add android:launchMode="singleInstance" in the manifest
// to keep multiple copies of this activity from getting created if the user has
// already manually launched the app.
this.StartActivity(intent);
haveDetectedBeaconsSinceBoot = true;
}
else
{
if (mainActivity != null) {
Log.Debug(TAG, "I see a beacon again");
}
else
{
// If we have already seen beacons before, but the monitoring activity is not in
// the foreground, we send a notification to the user on subsequent detections.
Log.Debug(TAG, "Sending notification.");
SendNotification();
}
}
}