|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Graphics;
using System.Xml;
using SampleListView.DataLayer;
using SampleListView.stockwebservice;
namespace SampleListView
{
[Activity(Label = "Get Stock")]
public class getstock : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
View titleView = Window.FindViewById(Android.Resource.Id.Title);
//update the default title
if (titleView != null)
{
IViewParent parent = titleView.Parent;
if (parent != null && (parent is View))
{
View parentView = (View)parent;
parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75, 0xFF));
}
}
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.GetStock);
}
public override bool OnCreateOptionsMenu(IMenu menu)
{
menu.Add("Market Watch").SetIcon(Android.Resource.Drawable.IcButtonSpeakNow);
menu.Add("Add Stock").SetIcon(Resource.Drawable.ic_tab_artists_grey);
menu.Add("Get Quote").SetIcon(Resource.Drawable.ic_tab_artists_white); ;
return true;
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.TitleFormatted.ToString())
{
case "Market Watch":
//MenuItemClicked(item.TitleFormatted.ToString()); break;
doOpenMarketWatch(); break;
case "Add Stock":
//MenuItemClicked(item.TitleFormatted.ToString()); break;
doOpenAddStock(); break;
case "Get Quote":
//MenuItemClicked(item.TitleFormatted.ToString()); break;
doOpenGetStock(); break;
}
return base.OnOptionsItemSelected(item);
}
void MenuItemClicked(string item)
{
Console.WriteLine(item + " option menuitem clicked");
var t = Toast.MakeText(this, "Options Menu '" + item + "' clicked", ToastLength.Short);
t.SetGravity(GravityFlags.Center, 0, 0);
t.Show();
}
protected void doOpenMarketWatch()
{
StartActivity(typeof(MarketWatch));
}
protected void doOpenAddStock()
{
StartActivity(typeof(AddStock));
}
protected void doOpenGetStock()
{
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Sandip is a "Software Architect, CEO, Founder at ClarityCX Solutions & Services Private Limited"
He has 24 years of rich experience working in software development in the areas of market research, web, mobile and e-commerce.
Sandip has wide ranging experience in C#, VB.NET, ASP.Net, JQuery, JSON, LINQ, WCF, WPF, NodeJs, MongoDB, AngularJS, Express, Silverlight, SOA, Android, IPhone, IPad and Windows Mobile applications.
Specialized in Hybrid and Native Apps in iOS, Android, Windows Phone, Blackberry, Symbian, Tizen, WebOS.
Sandip can be reached at sandip.net@gmail.com
Tweet: @sandipnascar
FB: https:sandipnascar
View My Page