本文整理汇总了C#中Android.Content.Intent.SetClassName方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.SetClassName方法的具体用法?C# Intent.SetClassName怎么用?C# Intent.SetClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.SetClassName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddIntent
public static Intent AddIntent(Context context, long portfolioId)
{
var intent = new Intent();
intent.SetClassName(context, ManifestNames.GetName<EditPositionActivity>());
intent.PutExtra(PORTFOLIOIDEXTRA, portfolioId);
return intent;
}
示例2: NavigateTo
/// <summary>
/// Navigate to specific latitude and longitude.
/// </summary>
/// <param name="name">Label to display</param>
/// <param name="latitude">Lat</param>
/// <param name="longitude">Long</param>
/// <param name="navigationType">Type of navigation</param>
public Task<bool> NavigateTo(string name, double latitude, double longitude, NavigationType navigationType = NavigationType.Default)
{
var uri = string.Empty;
if(string.IsNullOrWhiteSpace(name))
uri = string.Format("http://maps.google.com/maps?&daddr={0},{1}", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture));
else
uri = string.Format("http://maps.google.com/maps?&daddr={0},{1} ({2})", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture), name);
var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri));
intent.SetClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
if (TryIntent(intent))
return Task.FromResult(true);
var uri2 = string.Empty;
if (string.IsNullOrWhiteSpace(name))
uri2 = string.Format("geo:{0},{1}?q={0},{1}", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture));
else
uri2 = string.Format("geo:{0},{1}?q={0},{1}({2})", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture), name);
if (TryIntent(new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri2))))
return Task.FromResult(true);
if (TryIntent(new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri))))
return Task.FromResult(true);
Debug.WriteLine("No map apps found, unable to navigate");
return Task.FromResult(false);
}
示例3: getSamples
protected IList<IMap<String, Object>> getSamples()
{
ArrayList<IMap<String, Object>> samples = new ArrayList<IMap<String, Object>>();
foreach (IMap_IEntry<String, String> sample in SAMPLES_MAP.EntrySet().AsEnumerable<IMap_IEntry<String, String>>())
{
Intent sampleIntent = new Intent(Intent.ACTION_MAIN);
sampleIntent.SetClassName(GetApplicationContext(), sample.GetValue());
addItem(samples, sample.GetKey(), sampleIntent);
}
return samples;
}
示例4: NavigateTo
/// <summary>
/// Navigate to specific latitude and longitude.
/// </summary>
/// <param name="name">Label to display</param>
/// <param name="latitude">Lat</param>
/// <param name="longitude">Long</param>
/// <param name="navigationType">Type of navigation</param>
public void NavigateTo(string name, double latitude, double longitude, NavigationType navigationType = NavigationType.Default)
{
var uri = String.Format("http://maps.google.com/maps?&daddr={0},{1} ({2})", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture), name);
var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri));
intent.SetClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
if (TryIntent(intent))
return;
var uri2 = string.Format("geo:{0},{1}?q={0},{1}({2})", latitude.ToString(CultureInfo.InvariantCulture), longitude.ToString(CultureInfo.InvariantCulture), name);
if (TryIntent(new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri2))))
return;
if (TryIntent(new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri))))
return;
Toast.MakeText(Android.App.Application.Context, "Please install a maps application", ToastLength.Long).Show();
}
示例5: ActivityIntent
protected Intent ActivityIntent (string pkg, string componentName)
{
Intent result = new Intent ();
result.SetClassName (pkg, componentName);
return result;
}
示例6: LaunchActivityItem
private void LaunchActivityItem(ActivityListItem item)
{
if (item.IsSubMenu)
{
// Launch this menu activity again with an updated prefix
var result = new Intent();
result.SetClass(this, typeof(ListSamples));
result.PutExtra("dk.ostebaronen.viewpagerindicator.droid.Path", string.Format("{0}/{1}", item.Prefix, item.Name).Trim('/'));
StartActivity(result);
}
else
{
// Launch the item activity
var result = new Intent();
result.SetClassName(item.Package, item.Component);
StartActivity(result);
}
}
示例7: button_Click
// Explicitly finish an Activity by invoking the Finish activity inside the
// activity.
// To return a result to the parent activity you need to use
// the SetResult method and call the Finish method directly after that.
private void button_Click(object sender, EventArgs e)
{
Intent intent = new Android.Content.Intent();
intent.SetClassName(this.ApplicationContext, "MySecondActivity");
// Place the selected item in the intent
intent.PutExtra("Question", 10);
// Set the result of the activity
SetResult(Result.Ok, intent);
Finish();
return;
}
开发者ID:holisticware-admin,项目名称:HolisticWare.TheGeekGathering.Workshop,代码行数:18,代码来源:ActivityWithLayout1.axml.cs
示例8: Navigate
public async Task<NavigationResult> Navigate (AppLink appLink, JsonObject extras, RefererAppLink refererAppLink)
{
var context = Android.App.Application.Context;
var pm = context.PackageManager;
var appLinkDataJson = JsonSerializeAppLinkData (appLink, extras);
Intent eligibleTargetIntent = null;
foreach (var t in appLink.Targets) {
var target = t as AndroidAppLinkTarget;
if (target == null)
continue;
var targetIntent = new Intent (Intent.ActionView);
if (target.Url != null)
targetIntent.SetData (Android.Net.Uri.Parse(target.Url.ToString()));
else
targetIntent.SetData (Android.Net.Uri.Parse(appLink.SourceUrl.ToString()));
targetIntent.SetPackage (target.Package);
if (target.Class != null)
targetIntent.SetClassName (target.Package, target.Class);
targetIntent.PutExtra (KEY_APP_LINK_DATA, appLinkDataJson);
var resolved = pm.ResolveActivity (targetIntent, Android.Content.PM.PackageInfoFlags.MatchDefaultOnly);
if (resolved != null) {
eligibleTargetIntent = targetIntent;
break;
}
}
if (eligibleTargetIntent != null) {
eligibleTargetIntent.AddFlags (ActivityFlags.NewTask);
context.StartActivity (eligibleTargetIntent);
return NavigationResult.App;
}
// Fall back to the web if it's available
if (appLink.WebUrl != null) {
var webUrl = BuildUrl(appLink, appLink.WebUrl, extras);
var handled = RaiseWillNavigateToWebUrl (webUrl);
if (!handled) {
Intent launchBrowserIntent = new Intent (Intent.ActionView, Android.Net.Uri.Parse (webUrl.ToString ()));
launchBrowserIntent.AddFlags (ActivityFlags.NewTask);
context.StartActivity (launchBrowserIntent);
}
return NavigationResult.Web;
}
return NavigationResult.Failed;
}
示例9: LaunchActivityItem
private void LaunchActivityItem (ActivityListItem item)
{
if (item.IsSubMenu) {
// Launch this menu activity again with an updated prefix
Intent result = new Intent ();
result.SetClass (this, typeof(ViewPagerIndicator));
result.PutExtra ("com.example.android.apis.Path", string.Format ("{0}/{1}", item.Prefix, item.Name).Trim ('/'));
StartActivity (result);
} else {
// Launch the item activity
Intent result = new Intent ();
result.SetClassName (item.Package, item.Component);
StartActivity (result);
}
}
示例10: AddIntent
public static Intent AddIntent(Context context)
{
var intent = new Intent();
intent.SetClassName(context, ManifestNames.GetName<EditPortfolioActivity>());
return intent;
}
示例11: ScheduleAlarm
/// <summary>
/// The schedule alarm.
/// </summary>
/// <param name="wakeUp">
/// The wake up.
/// </param>
private void ScheduleAlarm(int wakeUp)
{
var alarms = this.GetSystemService(AlarmService).JavaCast<AlarmManager>();
if (alarms == null)
{
Log.Debug(Tag,"LVLDL couldn't get alarm manager");
return;
}
Calendar cal = Calendar.Instance;
cal.Add(CalendarField.Second, wakeUp);
Log.Debug(Tag,"LVLDL scheduling retry in {0} seconds ({1})", wakeUp, cal.Time.ToLocaleString());
var intent = new Intent(DownloaderServiceActions.ActionRetry);
intent.PutExtra(DownloaderServiceExtras.PendingIntent, this.pPendingIntent);
intent.SetClassName(this.PackageName, this.AlarmReceiverClassName);
this.alarmIntent = PendingIntent.GetBroadcast(this, 0, intent, PendingIntentFlags.OneShot);
alarms.Set(AlarmType.RtcWakeup, cal.TimeInMillis, this.alarmIntent);
}
示例12: RunIntentInService
internal static void RunIntentInService(Context context, Intent intent, string className)
{
lock (LOCK)
{
if (sWakeLock == null)
{
// This is called from BroadcastReceiver, there is no init.
var pm = PowerManager.FromContext(context);
sWakeLock = pm.NewWakeLock(WakeLockFlags.Partial, WAKELOCK_KEY);
}
}
Log.Verbose(TAG, "Acquiring wakelock");
sWakeLock.Acquire();
intent.SetClassName(context, className);
context.StartService(intent);
}
示例13: refresh
public void refresh()
{
mNames.Clear();
mIntents.Clear();
Intent mainIntent = new Intent(Intent.ActionMain, null);
mainIntent.AddCategory("com.readystatesoftware.systembartint.SAMPLE");
//mainIntent.AddCategory("systembartint.sample");
PackageManager pm = mContext.PackageManager;
IList<ResolveInfo> matches = pm.QueryIntentActivities(mainIntent, 0);
foreach (ResolveInfo match in matches)
{
Intent intent = new Intent();
intent.SetClassName(match.ActivityInfo.PackageName,
match.ActivityInfo.Name);
string name = match.LoadLabel(pm);
mNames.Add(name);
mIntents.Add(name, intent);
}
//mNames.Add("DefaultActivity");
//mIntents.Add("DefaultActivity", new Intent(mContext, typeof(DefaultActivity)));
//mNames.Add("ColorActivity");
//mIntents.Add("ColorActivity", new Intent(mContext, typeof(ColorActivity)));
//mNames.Add("MatchActionBarActivity");
//mIntents.Add("MatchActionBarActivity", new Intent(mContext, typeof(MatchActionBarActivity)));
NotifyDataSetChanged();
}
示例14: GotoIntent
public static Intent GotoIntent(Context context)
{
var intent = new Intent();
intent.SetClassName(context, ManifestNames.GetName<ConfigActivity>());
return intent;
}