本文整理汇总了C#中Android.Content.Intent.PutExtra方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.PutExtra方法的具体用法?C# Intent.PutExtra怎么用?C# Intent.PutExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.PutExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitView
private void InitView()
{
//设置标题栏
var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
img_header_back.Click += (sender, e) =>
{
SetResult(Result.Canceled);
this.Finish();
OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
};
var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
tv_back.Text = "关闭";
var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
tv_desc.Text = "收费设置";
//获取serviceType值
serviceType = Intent.GetIntExtra("serviceType",0);
//确定按钮
btn_Confirm = FindViewById<Button> (Resource.Id.btn_Confirm);
btn_Confirm.Click += (sender, e) =>
{
chargeYHour = edit_YHour.Text;
chargeYDay = edit_YDay.Text;
var intent = new Intent();
intent.PutExtra("chargeYHour",chargeYHour);
intent.PutExtra("chargeYDay",chargeYDay);
//todo:调用webservice提交服务器
SetResult(Result.Ok,intent);
this.Finish();
};
}
示例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
var registerButton = FindViewById<Button> (Resource.Id.registerButton);
var unregisterButton = FindViewById<Button> (Resource.Id.unregisterButton);
registerButton.Click += delegate {
const string senders = "<Google Cloud Messaging Sender ID>";
var intent = new Intent("com.google.android.c2dm.intent.REGISTER");
intent.SetPackage("com.google.android.gsf");
intent.PutExtra("app", PendingIntent.GetBroadcast(this, 0, new Intent(), 0));
intent.PutExtra("sender", senders);
StartService(intent);
};
unregisterButton.Click += delegate {
var intent = new Intent("com.google.android.c2dm.intent.UNREGISTER");
intent.PutExtra("app", PendingIntent.GetBroadcast(this, 0, new Intent(), 0));
StartService(intent);
};
}
示例3: InitView
private void InitView()
{
//设置标题栏
var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
img_header_back.Click += (sender, e) =>
{
SetResult(Result.Canceled);
this.Finish();
OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
};
var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
tv_back.Text = "返回";
var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
tv_desc.Text = "选择银行卡";
lv_bankType = FindViewById<ListView> (Resource.Id.lv_bankType);
bankCardInfoListAdapter = new BankCardInfoListAdapter (this);
lv_bankType.Adapter = bankCardInfoListAdapter;
//设置滑动listview停止加载图片
lv_bankType.SetOnScrollListener (new PauseOnScrollListener(Global.imageLoader,false,false));
lv_bankType.SetSelector (Resource.Color.red);//设置被选中项颜色为红
LoadTypeData ();
//点击列表详细
lv_bankType.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
{
var intent = new Intent();
intent.PutExtra("choosebankTypeId",bankCardInfoListAdapter.GetItem(e.Position).BankCardTypeId);
intent.PutExtra("choosebankImgUrl",bankCardInfoListAdapter.GetItem(e.Position).BankCardImageUrl);
SetResult(Result.Ok,intent);
this.Finish();
};
}
示例4: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.Inflate(Resource.Layout.CheckinsFragment, container, false);
listViewMovies = rootView.FindViewById<ListView> (Resource.Id.listViewMovies);
adapter = new MoviesAdapter (Activity);
listViewMovies.Adapter = adapter;
listViewMovies.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
Movie movie = adapter.GetMovie(e.Position);
Intent intent = new Intent (Activity, typeof(MovieActivity));
intent.PutExtra("movieId", movie.Id);
intent.PutExtra("mode", "info");
StartActivity(intent);
};
listViewMovies.ItemLongClick += delegate(object sender, AdapterView.ItemLongClickEventArgs e) {
DeleteMovieDialogFragment dialog = new DeleteMovieDialogFragment();
dialog.Movie = adapter.GetMovie(e.Position);
dialog.Show(FragmentManager, "DeleteMovieDialogFragment");
};
movies = new CheckinShared.MovieDB ();
checkins = new CheckinShared.CheckinDB ();
// Toast.MakeText(Activity, movies.Count() + " películas en tu colección", ToastLength.Long).Show();
RefreshList ();
return rootView;
}
示例5: StartImagePagerActivity
private void StartImagePagerActivity(int position)
{
Intent intent = new Intent(Activity, typeof(SimpleImageActivity));
intent.PutExtra(Constants.Extra.FRAGMENT_INDEX, ImagePagerFragment.INDEX);
intent.PutExtra(Constants.Extra.IMAGE_POSITION, position);
StartActivity(intent);
}
示例6: SendBroadcastForToastMessage
public static void SendBroadcastForToastMessage(Context context, string messageToToast)
{
var toastIntent = new Intent(AppConstants.APPLICATION_COMMAND);
toastIntent.PutExtra(AppConstants.COMMAND_TYPE_ID, (int)AppConstants.ApplicationCommandType.ShowToastMessage);
toastIntent.PutExtra(AppConstants.TOAST_MESSAGE_KEY, messageToToast);
context.SendBroadcast(toastIntent);
}
示例7: OnConnect
void OnConnect(object sender, EventArgs args)
{
var streamIntent = new Intent (this, typeof (GLActivity));
streamIntent.PutExtra("HostName", hostNameTextEdit.Text);
int port;
if (!int.TryParse (portTextEdit.Text, out port))
{
new AlertDialog.Builder(this).SetMessage("Incorrect port").Show();
return;
}
streamIntent.PutExtra("Port", port);
double bufferingOffset;
if (!double.TryParse(bufferingOffsetTextEdit.Text, out bufferingOffset))
{
new AlertDialog.Builder(this).SetMessage("Incorrect buffering offset").Show();
return;
}
streamIntent.PutExtra("BufferingOffset", bufferingOffset);
streamIntent.PutExtra("ShowDebugInfo", showDebugInfoCheckBox.Checked);
StartActivity(streamIntent);
}
示例8: OnBindViewHolder
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
{
NewsAdapterWrapper Myholder = holder as NewsAdapterWrapper;
Myholder.Titulo.Text = mPublicaciones [position].Titulo;
Myholder.Subtitulo.Text = mPublicaciones [position].Subtitulo;
Myholder.Fecha.Text = mPublicaciones [position].FechaPublicacion.ToString ();
Koush.UrlImageViewHelper.SetUrlDrawable (Myholder.Imagen, mPublicaciones [position].Imagen.ToString ());
Myholder.Detalle.Visibility = ViewStates.Gone;
Myholder.Imagen.Click += (object sender, EventArgs e) =>
{
Intent IntentNews = new Intent(this.mContext,typeof(NewsDetailActivity));
IntentNews.PutExtra ("TituloDetalle", mPublicaciones [position].Titulo);
IntentNews.PutExtra ("SubtituloDetalle", mPublicaciones [position].Subtitulo);
IntentNews.PutExtra ("FechaDetalle", mPublicaciones [position].FechaPublicacion.ToString ());
IntentNews.PutExtra ("ContenidoDetalle", mPublicaciones [position].Contenido.Trim ());
IntentNews.PutExtra ("ImagenDetalle", mPublicaciones [position].Imagen.ToString ());
this.mContext.StartActivity (IntentNews);
};
// Myholder.Detalle.Click += (object sender, EventArgs e) =>
// {
// Intent IntentNews = new Intent(this.mContext,typeof(NewsDetailActivity));
// IntentNews.PutExtra ("TituloDetalle", mPublicaciones [position].Titulo);
// IntentNews.PutExtra ("SubtituloDetalle", mPublicaciones [position].Subtitulo);
// IntentNews.PutExtra ("FechaDetalle", mPublicaciones [position].FechaPublicacion.ToString ());
// IntentNews.PutExtra ("ContenidoDetalle", mPublicaciones [position].Contenido.Trim ());
// IntentNews.PutExtra ("ImagenDetalle", mPublicaciones [position].Imagen.ToString ());
// this.mContext.StartActivity (IntentNews);
// };
}
示例9: GoMainActivity
void GoMainActivity()
{
var intent = new Intent(this, typeof(MainActivity));
intent.PutExtra("Name", m_name.Text);
intent.PutExtra("Pass", m_pass.Text);
StartActivity(intent);
}
示例10: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Itens);
List<ItemPedido> itensPedido = new List<ItemPedido>();
EditText nome = FindViewById<EditText> (Resource.Id.et_nome);
EditText preco = FindViewById<EditText> (Resource.Id.et_preco);
EditText quantidade = FindViewById<EditText> (Resource.Id.et_quantidade);
Button addItem = FindViewById<Button> (Resource.Id.bt_adicionar_item);
Button finalizar = FindViewById<Button> (Resource.Id.bt_finalizar);
ListView itens = FindViewById<ListView> (Resource.Id.list_item);
float total = 0;
addItem.Click += (object sender, EventArgs e) => {
if (nome.Text.Trim() == "" && preco.Text.Trim() == "" && quantidade.Text.Trim() == ""){
Toast.MakeText(this, "Preencha os campos acima", ToastLength.Long).Show();
} else {
itensPedido.Add(new ItemPedido(nome.Text, float.Parse(preco.Text), int.Parse(quantidade.Text), 1));
itens.Adapter = new AdapterItensMain (this, itensPedido);
total = total + (float.Parse(preco.Text) * int.Parse(quantidade.Text));
}
};
finalizar.Click += (object sender, EventArgs e) => {
itens.Adapter = new AdapterItens (this, itensPedido);
Intent intent = new Intent(this, typeof(MainActivity));
intent.PutExtra("itens", JsonConvert.SerializeObject(itensPedido));
intent.PutExtra("total", total.ToString());
StartActivity(intent);
Finish();
};
}
示例11: AddEvent
public void AddEvent(string name, DateTime startTime, DateTime endTime)
{
Intent intent = new Intent(Intent.ActionInsert);
intent.SetData(Android.Provider.CalendarContract.Events.ContentUri);
// Add Event Details
intent.PutExtra(Android.Provider.CalendarContract.ExtraEventBeginTime, DateTimeJavaDate(startTime));
intent.PutExtra(Android.Provider.CalendarContract.ExtraEventEndTime, DateTimeJavaDate(endTime));
intent.PutExtra(Android.Provider.CalendarContract.EventsColumns.AllDay, false);
// intent.PutExtra(Android.Provider.CalendarContract.EventsColumns.EventLocation, ""); TODO: event location
intent.PutExtra(Android.Provider.CalendarContract.EventsColumns.Description, "UTS:HELPS Workshop");
intent.PutExtra(Android.Provider.CalendarContract.EventsColumns.Title, name);
// open "Add to calendar" screen
Forms.Context.StartActivity(intent);
// TODO: add event directly
// https://github.com/xamarin/monodroid-samples/blob/master/CalendarDemo/EventListActivity.cs
//
// ContentValues eventValues = new ContentValues ();
// eventValues.Put (CalendarContract.Events.InterfaceConsts.CalendarId, ?? ?);
// eventValues.Put (CalendarContract.Events.InterfaceConsts.Title, "Test Event");
// eventValues.Put (CalendarContract.Events.InterfaceConsts.Description, "This is an event created from Mono for Android");
// eventValues.Put (CalendarContract.Events.InterfaceConsts.Dtstart, GetDateTimeMS (2011, 12, 15, 10, 0));
// eventValues.Put (CalendarContract.Events.InterfaceConsts.Dtend, GetDateTimeMS (2011, 12, 15, 11, 0));
//
// eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, "UTC");
// eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, "UTC");
//
// var uri = ContentResolver.Insert (CalendarContract.Events.ContentUri, eventValues);
// Console.WriteLine ("Uri for new event: {0}", uri);
}
示例12: OnSaveClick
void OnSaveClick(object sender, EventArgs e)
{
//
// Retrieve the values the user entered into the UI
//
string name = FindViewById<EditText>(Resource.Id.nameInput).Text;
int count = int.Parse(FindViewById<EditText>(Resource.Id.countInput).Text);
var intent = new Intent();
//
// Load the new data into an Intent for transport back to the Activity that started this one.
//
intent.PutExtra("ItemName", name );
intent.PutExtra("ItemCount", count);
//
// Send the result code and data back (this does not end the current Activity)
//
SetResult(Result.Ok, intent);
//
// End the current Activity.
//
Finish();
}
示例13: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SDKInitializer.Initialize(ApplicationContext);
GetLocation();
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
var hotelListView = FindViewById<ListView>(Resource.Id.HotelListView);
BindHotelView(this, hotelListView);
hotelListView.ItemClick += (sender, args) =>
{
var postion = args.Position;
var item = (HotelEntity)args.Parent.GetItemAtPosition(postion);
var intent = new Intent(this, typeof(DetailsActivity));
//设置意图传递的参数
//intent.PutExtra("HOTELENTITY", item);
intent.PutExtra("Name", item.Name);
intent.PutExtra("Latitude", item.Latitude);
intent.PutExtra("Longitude", item.Longitude);
StartActivity(intent);
};
}
示例14: ComposeEmail
public void ComposeEmail(
IEnumerable<string> to, IEnumerable<string> cc, string subject,
string body, bool isHtml,
IEnumerable<EmailAttachment> attachments)
{
// http://stackoverflow.com/questions/2264622/android-multiple-email-attachments-using-intent
var emailIntent = new Intent(Intent.ActionSendMultiple);
if (to != null)
{
emailIntent.PutExtra(Intent.ExtraEmail, to.ToArray());
}
if (cc != null)
{
emailIntent.PutExtra(Intent.ExtraCc, cc.ToArray());
}
emailIntent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);
body = body ?? string.Empty;
if (isHtml)
{
emailIntent.SetType("text/html");
emailIntent.PutExtra(Intent.ExtraText, Html.FromHtml(body));
}
else
{
emailIntent.SetType("text/plain");
emailIntent.PutExtra(Intent.ExtraText, body);
}
var attachmentList = attachments as IList<EmailAttachment> ?? attachments.ToList();
if (attachmentList.Any())
{
var uris = new List<IParcelable>();
DoOnActivity(activity =>
{
foreach (var file in attachmentList)
{
var fileWorking = file;
File localfile;
using (var localFileStream = activity.OpenFileOutput(
fileWorking.FileName, FileCreationMode.WorldReadable))
{
localfile = activity.GetFileStreamPath(fileWorking.FileName);
fileWorking.Content.CopyTo(localFileStream);
}
localfile.SetReadable(true, false);
uris.Add(Uri.FromFile(localfile));
localfile.DeleteOnExit(); // Schedule to delete file when VM quits.
}
});
emailIntent.PutParcelableArrayListExtra(Intent.ExtraStream, uris);
}
// fix for GMail App 5.x (File not found / permission denied when using "StartActivity")
StartActivityForResult(0, Intent.CreateChooser(emailIntent, string.Empty));
}
示例15: ProcessHttpRequest
void ProcessHttpRequest (HttpListenerContext context)
{
try {
string barcodeFormatStr = context.Request?.QueryString? ["format"] ?? "QR_CODE";
string barcodeValue = context?.Request?.QueryString? ["value"] ?? "";
string barcodeUrl = context?.Request?.QueryString? ["url"] ?? "";
// Pass along the querystring values
var intent = new Android.Content.Intent (this, typeof (MainActivity));
intent.PutExtra ("FORMAT", barcodeFormatStr);
intent.PutExtra ("VALUE", barcodeValue);
intent.PutExtra ("URL", barcodeUrl);
intent.AddFlags (ActivityFlags.NewTask);
// Start the activity to show the values
StartActivity (intent);
// Return a success
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.StatusDescription = "OK";
context.Response.Close ();
} catch (Exception e) {
Console.WriteLine ("Error " + e.Message);
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
context.Response.Close ();
}
}