本文整理汇总了C#中Bundle.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.GetString方法的具体用法?C# Bundle.GetString怎么用?C# Bundle.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public override void Handle(Bundle bundle)
{
//�������������������֪ͨ�ı��⡣
//��Ӧ API ֪ͨ���ݵ� title �ֶΡ�
//��Ӧ Portal ����֪ͨ�����ϵġ�֪ͨ���⡱�ֶΡ�
var title = bundle.GetString(JPushInterface.ExtraNotificationTitle);
//�������������������֪ͨ���ݡ�
//��Ӧ API ֪ͨ���ݵ� alert �ֶΡ�
//��Ӧ Portal ����֪ͨ�����ϵġ�֪ͨ���ݡ��ֶΡ�
var ctx = bundle.GetString(JPushInterface.ExtraAlert);
//SDK 1.2.9 ���ϰ汾֧�֡�
//������������������ĸ����ֶΡ����Ǹ� JSON �ַ�����
//��Ӧ API ֪ͨ���ݵ� extras �ֶΡ�
//��Ӧ Portal ������Ϣ�����ϵġ���ѡ���á���ĸ����ֶΡ�
var extra = bundle.GetString(JPushInterface.ExtraExtra);
//SDK 1.3.5 ���ϰ汾֧�֡�
//֪ͨ����Notification ID�������������Notification
var id = bundle.GetString(JPushInterface.ExtraNotificationId);
//SDK 1.6.1 ���ϰ汾֧�֡�
//Ψһ��ʶ֪ͨ��Ϣ�� ID, �������ϱ�ͳ�Ƶȡ�
var msgID = bundle.GetString(JPushInterface.ExtraMsgId);
}
示例2: 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
editText = FindViewById<EditText> (Resource.Id.editText1);
button = FindViewById<Button> (Resource.Id.unlockButton);
masterCodeText = FindViewById<TextView>(Resource.Id.masterCodeText);
serviceCodeText = FindViewById<TextView>(Resource.Id.serviceCodeText);
button.Click += delegate
{
string masterCode;
string serviceCode;
ulong userCode;
if (ulong.TryParse(editText.Text, out userCode))
{
ThreeDSUnlockLib.Unlocker.GetUnlockKey(userCode, out masterCode, out serviceCode);
masterCodeText.Text = masterCode;
serviceCodeText.Text = serviceCode;
}
};
if (bundle != null)
{
editText.Text = bundle.GetString ("editText");
masterCodeText.Text = bundle.GetString ("masterCodeText");
serviceCodeText.Text = bundle.GetString ("serviceCodeText");
}
}
示例3: SendNotification
private void SendNotification (Bundle data) {
Intent intent;
string type = data.GetString("type");
intent = new Intent (this, typeof(MainActivity));
if(type.Equals(PUSH_INVITE)) {
ViewController.getInstance().pushEventId = Convert.ToInt32(data.GetString("eventId"));
intent.SetAction(PUSH_INVITE);
} else if(type.Equals(PUSH_EVENT_UPDATE)) {
ViewController.getInstance().pushEventId = Convert.ToInt32(data.GetString("eventId"));
intent.SetAction(PUSH_EVENT_UPDATE);
} else if(type.Equals(PUSH_DELETE)) {
//nothing else need to be done
//MainActivity will refresh the events on start
}
intent.AddFlags (ActivityFlags.ClearTop);
var pendingIntent = PendingIntent.GetActivity (this, 0, intent, PendingIntentFlags.OneShot);
var notificationBuilder = new Notification.Builder(this)
.SetSmallIcon (Resource.Drawable.pushnotification_icon)
.SetContentTitle (data.GetString("title"))
.SetContentText (data.GetString ("message"))
.SetVibrate(new long[] {600, 600})
.SetAutoCancel (true)
.SetContentIntent (pendingIntent);
var notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
notificationManager.Notify (notificationId, notificationBuilder.Build());
notificationId++;
}
示例4: OnRestoreInstanceState
protected override void OnRestoreInstanceState(Bundle savedInstanceState)
{
this.topicName = savedInstanceState.GetString("topicName");
this.topicArn = savedInstanceState.GetString("topicArn");
this.createTopic.Enabled = topicName == null;
this.subscribe.Enabled = topicName != null;
this.deleteTopic.Enabled = topicName != null;
}
示例5: OnMessageReceived
public override void OnMessageReceived (string from, Bundle data) {
var message = data.GetString ("message");
var type = data.GetString("type");
Log.Info ("MyGcmListenerService", "From: " + from);
Log.Info ("MyGcmListenerService", "Message: " + message);
Log.Info ("MyGcmListenerService", "Type: " + type);
if(!type.Equals(PUSH_REGISTRATION_VALIDATION))
SendNotification (data);
}
示例6: OnMessageReceived
public override void OnMessageReceived(string from, Bundle data)
{
MessaggioNotifica m = new MessaggioNotifica ();
string messaggio = data.GetString ("messaggio");
string titolo = data.GetString ("titolo");
string commessa = data.GetString ("commessa");
string tipo = data.GetString ("tipo");
m.Titolo = titolo; m.Messaggio = messaggio; m.Commessa = commessa; m.Tipo = tipo;
Log.Debug ("MyGcmListenerService", "Message: " + messaggio);
SendNotification (m);
}
示例7: Server
public Server(Bundle b)
: this(b.GetInt("SERVER_ID"),
b.GetString("SERVER_NAME"),
b.GetString("SERVER_SCHEME"),
b.GetString("SERVER_HOSTNAME"),
b.GetInt("SERVER_PORT"),
b.GetString("SERVER_USER"),
b.GetString("SERVER_PASS"),
b.GetInt("SERVER_GID"))
{
}
示例8: OnMessageReceived
public override async void OnMessageReceived(string from, Bundle data)
{
if (!ServiceFinder.IsRegistered<IPush>())
{
await FHClient.Init();
FH.RegisterPush(DefaultHandleEvent);
}
var push = ServiceFinder.Resolve<IPush>() as Push;
var message = data.GetString("alert");
var messageData = data.KeySet().ToDictionary(key => key, key => data.GetString(key));
(push.Registration as GcmRegistration).OnPushNotification(message, messageData);
}
示例9: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.WikiNoteEditor);
_noteEdit = (EditText)FindViewById(Resource.Id.noteEdit);
string wikiNoteText = bundle == null ? null : bundle.GetString(WikiNote.Notes.BODY);
string wikiNoteTitle = bundle == null ? null : bundle.GetString(WikiNote.Notes.TITLE);
if (wikiNoteTitle == null)
{
Bundle extras = Intent.Extras;
wikiNoteText = extras == null ? null : extras.GetString(WikiNote.Notes.BODY);
wikiNoteTitle = extras == null ? null : extras.GetString(WikiNote.Notes.TITLE);
}
// If we have no title information, this is an invalid intent request
if (TextUtils.IsEmpty(wikiNoteTitle))
{
// no note title - bail
SetResult(Result.Canceled);
Finish();
return;
}
_wikiNoteTitle = wikiNoteTitle;
// set the title so we know which note we are editing
Title = GetString(Resource.String.wiki_editing, wikiNoteTitle);
// but if the body is null, just set it to empty - first edit of this note
wikiNoteText = wikiNoteText == null ? "" : wikiNoteText;
// set the note body to edit
_noteEdit.Text = wikiNoteText;
// set listeners for the confirm and cancel buttons
((Button)FindViewById(Resource.Id.confirmButton))
.Click += delegate {
Intent i = new Intent();
i.PutExtra(ACTIVITY_RESULT, _noteEdit.Text);
SetResult(Result.Ok, i);
Finish();
};
((Button)FindViewById(Resource.Id.confirmButton))
.Click += delegate {
SetResult(Result.Canceled);
Finish();
};
}
示例10: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
userName = bundle.GetString ("Username");
password = bundle.GetString ("Password");
SetContentView (Resource.Layout.SignupPage);
informativeText = FindViewById<TextView> (Resource.Id.InformativeText);
actionButton = FindViewById<Button> (Resource.Id.ActionButton);
secondActionButton = FindViewById<Button> (Resource.Id.ActionSecondButton);
progress = FindViewById<ProgressBar> (Resource.Id.Spinner);
actionButton.Click += CancelAction;
}
示例11: OnMessageReceived
/// <summary>
/// This method gets called when a message is received by the listener
/// </summary>
/// <param name="from">The user who send the message</param>
/// <param name="data">The data of the message, includes the message text and message code</param>
public override void OnMessageReceived(string from, Bundle data)
{
var message = data.GetString("message");
int ms_code = 0;
int.TryParse((data.GetString ("message_code")), out ms_code);
string username = data.GetString ("username_from");
//Create a new message object to be stored
MeetMeet_Native_Portable.Droid.Message m = new MeetMeet_Native_Portable.Droid.Message ();
m.MsgText = message;
m.Date = System.DateTime.Now.ToString();
m.incoming = true;
//Check the message code to decide what to do with the message
if(ms_code == 1)
{
//This is for single messages, simply save the message and display a notification
m.UserName = username;
MessageRepository.SaveMessage (m);
SendNotification(message, username);
}
else if(ms_code == 2)
{
//This is for group invites, bring up the invite screen
Intent intent = new Intent(this, typeof(InviteRequestActivity));
intent.PutExtra ("username_from", username);
intent.SetFlags (ActivityFlags.NewTask);
StartActivity(intent);
}
else if(ms_code == 3){
//This is for group messages, save the message to the group conversation and add the sending user's name
//to the message text. Then display a notification
m.UserName = "group";
m.MsgText = username + ": " + m.MsgText;
MessageRepository.SaveMessage (m);
SendNotification(message, m.UserName);
}
//Try to add it to the inbox, if the inbox has been created.
//Otherwise, it will get added automatically when the user opens the inbox
ViewInbox inbox = (ViewInbox)MainActivity.references.Get ("Inbox");
if(inbox != null)
{
inbox.newMessage (m);
}
}
示例12: OnCreateLoader
public Loader OnCreateLoader (int loaderIndex, Bundle args)
{
// Where the Contactables table excels is matching text queries,
// not just data dumps from Contacts db. One search term is used to query
// display name, email address and phone number. In this case, the query was extracted
// from an incoming intent in the handleIntent() method, via the
// intent.getStringExtra() method.
String query = args.GetString (QUERY_KEY);
var uri = Android.Net.Uri.WithAppendedPath (ContactsContract.CommonDataKinds.Contactables.ContentFilterUri, query);
// Easy way to limit the query to contacts with phone numbers.
String selection = ContactsContract.CommonDataKinds.Contactables.InterfaceConsts.HasPhoneNumber + " = " + 1;
// Sort results such that rows for the same contact stay together.
String sortBy = ContactsContract.CommonDataKinds.Contactables.InterfaceConsts.LookupKey;
return new CursorLoader (
mContext, // Context
uri, // URI representing the table/resource to be queried
null, // projection - the list of columns to return. Null means "all"
selection, // selection - Which rows to return (condition rows must match)
null, // selection args - can be provided separately and subbed into selection.
sortBy); // string specifying sort order
}
示例13: CreateFromBundle
public static AppTask CreateFromBundle(Bundle b, AppTask failureReturn)
{
if (b == null)
return failureReturn;
string taskType = b.GetString(AppTaskKey);
if (string.IsNullOrEmpty(taskType))
return failureReturn;
try
{
Type type = Type.GetType("keepass2android." + taskType);
if (type == null)
return failureReturn;
AppTask task = (AppTask)Activator.CreateInstance(type);
task.Setup(b);
return task;
}
catch (Exception e)
{
Kp2aLog.Log("Cannot convert " + taskType + " in task: " + e);
return failureReturn;
}
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
RequestWindowFeature(WindowFeatures.NoTitle);
base.OnCreate(bundle);
SetContentView(Resource.Layout.Viewer);
// associate the views
MainImage = FindViewById<ZoomImageView>(Resource.Id.MainImage);
Zoom = FindViewById<ZoomControls>(Resource.Id.ZoomButtons);
OpenButton = FindViewById<ImageButton>(Resource.Id.OpenButton);
LeftButton = FindViewById<ImageButton>(Resource.Id.LeftButton);
RightButton = FindViewById<ImageButton>(Resource.Id.RightButton);
// wire the views
Zoom.ZoomInClick += (src, args) => MainImage.ZoomIn();
Zoom.ZoomOutClick += (src, args) => MainImage.ZoomOut();
OpenButton.Click += (src, args) => OnOpenButtonClick(args);
LeftButton.Click += (src, args) => OnLeftButtonClick(args);
RightButton.Click += (src, args) => OnRightButtonClick(args);
// get preferences
var prefs = GetSharedPreferences("Global", FileCreationMode.Private);
// check bundles and prefs
if (Intent.Extras != null && Intent.Extras.ContainsKey("ComicsPath"))
Controller = new ViewerController(this, Intent.Extras.GetString("ComicsPath"));
else if (bundle != null && bundle.ContainsKey("ComicsPath"))
Controller = new ViewerController(this, bundle.GetString("ComicsPath"));
else
Controller = new ViewerController(this, prefs.GetString("ComicsPath", null));
}
示例15: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (savedInstanceState != null)
{
_myShow = new TVShow();
_myShow = JsonConvert.DeserializeObject<TVShow>(savedInstanceState.GetString("showSerialized"));
}
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
var view = inflater.Inflate(Resource.Layout.show_description_fragment, container, false);
var backgroundLinearLayout = view.FindViewById<LinearLayout>(Resource.Id.linLayout);
//backgroundLinearLayout.SetBackgroundColor(Color.Red);
//Koush.UrlImageViewHelper.SetUrlDrawable(backgroundLinearLayout,
// "http://image.tmdb.org/t/p/w92" + _myShow.Seasons[position].PosterPath);
var showTitle = view.FindViewById<TextView>(Resource.Id.showTitle);
showTitle.Text = _myShow.Name + " with " + _myShow.Actors.Count + " in the cast and the Overview:"+ _myShow.Overview;
return view;
}