本文整理汇总了C#中Android.App.Activity类的典型用法代码示例。如果您正苦于以下问题:C# Activity类的具体用法?C# Activity怎么用?C# Activity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Activity类属于Android.App命名空间,在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewShowcaseStep
public ViewShowcaseStep(Activity activity, int viewId)
{
this.parentActivity = new WeakReference<Activity>(activity);
this.viewId = viewId;
Setup();
}
示例2: CriarChamada
public void CriarChamada(Activity activity)
{
isRecording = !isRecording;
if (isRecording)
{
// Cria o INTENT
var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
// Abre um modal com uma mensagem de voz
voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Diga o nome da pessoa");
// Se passar de 5.5s considera que não há mensagem falada
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 5500);
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
// Para chamadas em outras líguas
// voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German);
// if you wish it to recognise the default Locale language and German
// if you do use another locale, regional dialects may not be recognised very well
voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
activity.StartActivityForResult(voiceIntent, Constants.VOICE);
}
}
示例3: ProgressShower
public ProgressShower(Activity activity)
: base(activity)
{
Indeterminate = true;
SetProgressStyle(ProgressDialogStyle.Horizontal);
SetButton("Cancel",_click);
}
示例4: ExpendListAdapter
public ExpendListAdapter(Activity activity,
Dictionary<string, List<string> > dictGroup)
{
_dictGroup = dictGroup;
_activity = activity;
_lstGroupID = dictGroup.Keys.ToList();
}
示例5: MyVote_ChangeButton
public MyVote_ChangeButton(Activity context, string imgId, ImageView imgView,int position)
{
this.context = context;
imageID = imgId;
imageView = imgView;
this.position = position;
}
示例6: SystemUiHiderHoneycomb
public SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags)
: base(activity, anchorView, flags)
{
#if __ANDROID_11__
m_ShowFlags = (int)SystemUiFlags.Visible;
m_HideFlags = (int)SystemUiFlags.LowProfile;
m_TestFlags = (int)SystemUiFlags.LowProfile;
if ((m_Flags & FLAG_FULLSCREEN) != 0)
{
// If the client requested fullscreen, add flags relevant to hiding
// the status bar. Note that some of these constants are new as of
// API 16 (Jelly Bean). It is safe to use them, as they are inlined
// at compile-time and do nothing on pre-Jelly Bean devices.
m_ShowFlags |= (int)SystemUiFlags.LayoutFullscreen;
m_HideFlags |= (int)SystemUiFlags.LayoutFullscreen | (int)SystemUiFlags.Fullscreen;
}
if ((m_Flags & FLAG_HIDE_NAVIGATION) != 0)
{
// If the client requested hiding navigation, add relevant flags.
m_ShowFlags |= (int)SystemUiFlags.LayoutHideNavigation;
m_HideFlags |= (int)SystemUiFlags.LayoutHideNavigation
| (int)SystemUiFlags.HideNavigation;
m_TestFlags = (int)SystemUiFlags.HideNavigation;
}
#endif
}
示例7: BindDataToView
public void BindDataToView(TextView characterCountTextView, Action validate, Activity activity, SuggestionsLayout suggestionsView)
{
Validate = validate;
CharacterCountTextView = characterCountTextView;
Activity = activity;
SuggestionsView = suggestionsView;
}
示例8: ProtoPadServer
private ProtoPadServer(View window, int? overrideListeningPort = null, string overrideBroadcastedAppName = null)
{
_window = window;
_contextActivity = window.Context as Activity;
_httpServer = new SimpleHttpServer(responseBytes =>
{
var response = "{}";
var remoteCommandDoneEvent = new AutoResetEvent(false);
_contextActivity.RunOnUiThread(() => Response(responseBytes, remoteCommandDoneEvent, ref response));
remoteCommandDoneEvent.WaitOne();
return response;
});
IPAddress broadCastAddress;
using (var wifi = _contextActivity.GetSystemService(Android.Content.Context.WifiService) as WifiManager)
{
_mcLock = wifi.CreateMulticastLock("ProtoPadLock");
_mcLock.Acquire();
broadCastAddress = GetBroadcastAddress(wifi);
}
BroadcastedAppName = overrideBroadcastedAppName ?? String.Format("ProtoPad Service on ANDROID Device {0}", Android.OS.Build.Model);
ListeningPort = overrideListeningPort ?? 8080;
LocalIPAddress = Helpers.GetCurrentIPAddress();
_udpServer = new UdpDiscoveryServer(BroadcastedAppName, String.Format("http://{0}:{1}/", LocalIPAddress, ListeningPort), broadCastAddress);
}
示例9: PilotListCounterFragment
public PilotListCounterFragment(string title, PilotListAdapter pilotList, Activity parent)
: base()
{
mTitle = title;
mPilotList = pilotList;
mParent = parent;
}
示例10: OnDraw
//protected override void OnElementChanged(VisualElement oldModel, VisualElement newModel)
//protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
protected override void OnDraw(Canvas canvas)
{
_activity = this.Context as Activity;
ActionBar actionBar = _activity.ActionBar;
if (actionBar.TabCount > 0)
{
ActionBar.Tab tabPrompting = actionBar.GetTabAt(0);
ActionBar.Tab tabActivities = actionBar.GetTabAt(1);
ActionBar.Tab tabReminders = actionBar.GetTabAt(2);
ActionBar.Tab tabMapping = actionBar.GetTabAt(3);
ActionBar.Tab tabSettings = actionBar.GetTabAt(4);
//Set the tab icons
tabPrompting.SetIcon(Resource.Drawable.ic_description_white_24dp);
tabActivities.SetIcon(Resource.Drawable.ic_local_activity_white_24dp);
tabReminders.SetIcon(Resource.Drawable.ic_schedule_white_24dp);
tabMapping.SetIcon(Resource.Drawable.ic_map_white_24dp);
tabSettings.SetIcon(Resource.Drawable.ic_settings_white_24dp);
//Remove the page's title from the tab
tabPrompting.SetText("");
tabActivities.SetText("");
tabReminders.SetText("");
tabMapping.SetText("");
tabSettings.SetText("");
base.OnDraw(canvas);
}
}
示例11: OnActivityStarted
public void OnActivityStarted(Activity activity)
{
CrossCurrentActivity.Current.Activity = activity;
#if !XTC
HockeyApp.Tracking.StartUsage(activity);
#endif
}
示例12: isNetworkConnected
/// <summary>
/// 网络是否联通
/// </summary>
public static bool isNetworkConnected(Activity active)
{
bool net = false;
ConnectivityManager connManager = (ConnectivityManager)active.GetSystemService(Context.ConnectivityService);
// connManager.ActiveNetworkInfo ==null 手机无法连接网络
if (connManager.ActiveNetworkInfo != null)
{
//获得 wifi 连接管理
NetworkInfo networkInfo = connManager.GetNetworkInfo(ConnectivityType.Wifi);
//获得 GPRS 连接管理
NetworkInfo gp = connManager.GetNetworkInfo(ConnectivityType.Mobile);
if (networkInfo != null && networkInfo.IsAvailable != false)
{
//Toast.MakeText(active, "WIFI打开!", ToastLength.Long).Show();
net = true;
}
// gp.IsConnected==false 有信号无网络
if (gp != null && gp.IsConnected != false)
{
//Toast.MakeText(active, "有信号gprs打开!", ToastLength.Long).Show();
net = true;
}
}
else
{
//Toast.MakeText(active, "无法连接到互联网!", ToastLength.Long).Show();
}
return net;
}
示例13: AdvertisementItemListAdapter
public AdvertisementItemListAdapter(Activity context, List<AdvertisementItemShort> advertisementItems, IInfiniteScrollListener infiniteScrollListener) {
this.AdvertisementItems = advertisementItems;
this.context = context;
this.bitmapOperationService = new BitmapOperationService();
this.infiniteScrollListener = infiniteScrollListener;
CalculateSizeForPhotoImageView();
}
示例14: MyVote_YesOrNoDialog
public MyVote_YesOrNoDialog(Activity context, string imgId, ImageView imgView,int position)
{
this.context = context;
imageId = imgId;
imageView = imgView;
this.position = position;
}
示例15: UnbindPopWindow
public UnbindPopWindow (Activity _activity,GuardianInfoListItem item)
{
activity = _activity;
LayoutInflater inflater = (LayoutInflater) activity.GetSystemService (Context.LayoutInflaterService);
contentView = inflater.Inflate(Resource.Layout.customunbinddialogLayout, null);
ContentView = contentView;
Width = 900;
Height = 450;
Focusable = true;
OutsideTouchable = true;
//Update ();
SetBackgroundDrawable (new ColorDrawable());
AnimationStyle = Resource.Style.AnimationPreview;
var btn_confirm = contentView.FindViewById<Button> (Resource.Id.btn_confirm);
btn_confirm.Click += (sender, e) =>
{
Dismiss();
if(UnBindEventHandler != null)
UnBindEventHandler(item);
};
var btn_cancel = contentView.FindViewById<Button> (Resource.Id.btn_cancel);
btn_cancel.Click += (sender, e) =>
{
Dismiss();
};
DismissEvent += (sender, e) =>
{
BackgroundAlpha(1f);
};
}