大叔也说Xamarin~Android篇~调用远程API接口,发POST请求

时间:2022-09-04 23:03:10

回到目录

Xamarin我们在上节已经教大家如何去部署它的环境了,今天来说一个实际的例子,使用android客户调用.net web api的一个接口,并发送POST请求,当服务端回到请求后做出响应,客户端android将响应的内容输出,并跳换到别一个Activity页面,在新视图上加载网页内容到webView控件上,整个流程结束!

一 在主页面上添加几个表单元素,账号,密码,登陆按钮,并在Activity类的OnCreate方法中为它们赋值,并添加按钮的click事件

     protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState); // 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
Button button = FindViewById<Button> (Resource.Id.myButton); button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
};
Android.Util.Log.Info ("normal", "日志zzl");
var loginBtn = FindViewById<Button> (Resource.Id.loginBtn);
var username = FindViewById<TextView> (Resource.Id.username);
var password = FindViewById<TextView> (Resource.Id.password);
var result = FindViewById<TextView> (Resource.Id.result);
loginBtn.Click += delegate { string url = "http://api.xuexiba.com/v1/User/Login";
//创建HttpClient(注意传入HttpClientHandler)
using (var http = new HttpClient ()) {
var content = new FormUrlEncodedContent (new Dictionary<string, string> () {
{ "username",username.Text },
{ "password",password.Text } }); var response = http.PostAsync (url, content);
result.Text = response.Result.Content.ReadAsStringAsync ().Result;
Intent intent = new Intent(this, typeof(ViewPageActivity));
StartActivity(intent); }
};
}

二 在ViewPageActivity里添加一个webView用来显示网页的内容,如下代码

    protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.ViewPage);
var webView = FindViewById<WebView> (Resource.Id.webView);
//启用Javascript Enable
webView.Settings.JavaScriptEnabled = true;
//载入网址
webView.LoadUrl ("http://www.sina.com");
//直接在当前webView上打开
webView.SetWebViewClient (new CustWebViewClient ()); }

注意,代码webView.SetWebViewClient (new CustWebViewClient ())表示使用现有的webView加载网页内容,而如果不加这行,那么网页将使用系统自带的浏览器进行加载,

下载看一下CustWebViewClient 这个类的内容

public class CustWebViewClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading (WebView view, string url)
{
view.LoadUrl (url);
return true;
} }

OK,在我们设计页面时,可以直接从工具箱上进行拖动,最后布局向这样

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWUAAAEdCAIAAABbluFAAAAfhUlEQVR4nO2deXQUVaLGKwsi4kMYRREwgAHCEhQERNwYQRgDQRw2t0GRR1gFRhYBWcTljR4FF/QZH6IcFwRxBZnBjAKRXQhZSYAEydKdTrrT+w1Z8MC8Py6pVHqpVFdV36qufL/znZxOpXJDqsznV7du9cddVIbD4VA4AkbDaBgtUkbjLl68WFVV5fPR6XTyH+kW+vPoFpfLFfC1/zgYDaNhNCONxl1UBh1LLTAaRsNoeh7NN1/Y7Xb+Y7DtQh+iH6kP+TsWRsNoGM1Io4WcL+qbYrfb69UDo2G0ljya8A9N7/MXQi/x8aH6+nqbzcZ/dDgc9fX1dLv/V+lH4VfpcRRux2gYDaNJGU08Cwj/Tv3TAU0EwbKDvNGC5ot6ARkAAC04c+YM/RtUmAvo379yAt8foT5HvdBut2dkZJwFALAlPz//1KlTwjxyMdD/82kuoB+FeUGYEcRThvTRAuQLYbKoq6urq6uDXwDAnvz8/NOnT9fV1fF/j7JzAXUEhdTX13MX/WZBqZPV1dU5HI7a2lqbzQa/AIA9NF/U1tb6zIBcbFgNIXwtnK3wn6Hwv0si/KuXMprNZjt9+nSTfOETK2pra2tqai5cuAC/AIA9NF/U1NTU1tYqTBnUBZRgMpkKCws5oaPQGdq6ujqbzVZbW2u1Wqurqy0WC/wCAPbk5+fn5eVduHChqqqqtraWzirSv1Ph//+FeUGYFIRf9d9H+FHKaDk5OTU1NY35QhguaLKorq4mhHg8HvgFAOzJz8/Pz88nhFy4cMEnZYSaDpTni5MnT166dKkxX/D3RITJwu12m81m+AUA7MnPz8/NzfV4PBaLhU8Z9K5lsNQgnLkQJohg+web1/AfLSMj4/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0C/GQCgCQzyBfrNADAIIn6BfjMAQBMiMl/Y0W8GgBY0my/QbwYAuAKDfKHa+gs7+s0A0BTxfIF+MwBAIwzyBfrNADAIIn6BfjMAQBMiLF+g3wwADRHxC/SbAQCawCBfqPl8qh39ZgBoR7P5Av1mAIArMMgX6DcDwCBIzBfoNwMARNL7X/w/8fRCu9hqYvMAAAAASUVORK5CYII=" alt="" />

最后进行APK的生成,我们的程序包就算完成了!

回到目录

大叔也说Xamarin~Android篇~调用远程API接口,发POST请求的更多相关文章

  1. 大叔也说Xamarin~Android篇~为HttpClient共享Session,android与api的session共享机制

    回到目录 杂谈 在进行android进行开发时,我们的数据一般通过接口来获收,这里指的接口泛指web api,webservice,wcf,web应用程序等:它们做为服务端与数据库进行直接通讯,而AP ...

  2. 大叔也说Xamarin~Android篇~环境部署与破解

    回到目录 现在移动开发很HOT,以至于很多人都转向了它,大叔也不例外,这次有机制接触一下xamarin这个东西,其实之前也用于xamarin,只是用来写网页程序,没有接触到移动开发,对于xamarin ...

  3. 大叔也说Xamarin~Android篇~ListView里的Click事件并获取本行的其它元素

    回到目录 我原创,我贡献,我是仓储大叔 本篇大叔原创,本着对技术的热爱去研究它,把成果分享给国人!大叔始终相信一句话:你只有选择一个感兴趣的工作,你才能更好的发挥你的潜力,而这一切都建立在你不断研究, ...

  4. 大叔也说Xamarin~Android篇~支付宝SDK的集成

    回到目录 首先做为支付宝SDK它提供了多种平台,网页版,wap版,IOS版,android版等等,今天主要说一下在xamarin里使用android平台的sdk的方法,在网上介绍这块的文章不多,大叔本 ...

  5. 大叔也说Xamarin~Android篇~监听返回键,单击返回某个webView,双击退出

    回到目录 这个操作在原生android里是很容易实现的,在xamarin里也不难,在activity里有方法OnKeyDown,我们只需要重写一下就可以了,然后通过webView重新加载到要返回的页面 ...

  6. 大叔也说Xamarin~Android篇~日志的记录

    回到目录 无论哪个平台,开始哪种应用程序,日志总是少不了的,大家在Lind.DDD里也可以看到大叔的日志组件,而在xamarin进行移动开发时,为了更好的调试,记录运行的情况,日志也是必须的,这讲主要 ...

  7. 大叔也说Xamarin~Android篇~Activity之间传递数组

    回到目录 我们在开发应用程序时,不可能只使用一个Layout或者一个Activity,比如你个管理系统,要求用户先登陆然后再使用,这时你至少要有两个activity吧,先登陆一个,然后成功后需要跳到别 ...

  8. 大叔也说Xamarin~Android篇~支付宝SDK的错误与解决

    回到目录 在为android程序引入支付宝后,可能没有那么顺利,有能出现各种各样的问题,大叔在引用支付宝后就出现了APL64的错误,在网上找不很多资料都不对正,还是在官网找到了几句话,说到了点子上,具 ...

  9. 大叔也说Xamarin~Android篇~原生登陆与WebView的网站如何共享Session

    回到目录 事情是这样的,我们最近开了一个APP,主要使用xamarin做了一个登陆,它与服务器API进行数据通讯,当用户名密码正确去,跳转到新的activity,并在webview控件中打开服务端的H ...

随机推荐

  1. 解决点击cell时,UILabel的背景颜色消失的问题

    -(void)setSelected:(BOOL)selected animated:(BOOL)animated{ [super setSelected:selected animated:anim ...

  2. BZOJ 4717 改装

    Description [题目背景] 小Q最近喜欢上了一款游戏,名为<舰队connection>,在游戏中,小Q指挥强大的舰队南征北战,从而成为了一名dalao.在游戏中,不仅船只能力很重 ...

  3. HDU 4497 GCD and LCM &lpar;数论&rpar;

    题意:三个数x, y, z. 给出最大公倍数g和最小公约数l.求满足条件的x,y,z有多少组. 题解:设n=g/l n=p1^n1*p2^n2...pn^nk (分解质因数 那么x = p1^x1 * ...

  4. C&num; INotifyPropertyChanged使用方法

    INotifyPropertyChanged 接口:向客户端发出某一属性值已更改的通知. NotifyPropertyChanged 接口用于向客户端(通常是执行绑定的客户端)发出某一属性值已更改的通 ...

  5. 简单的Spring Web工程跳转且传参Demo

    jdbc.properties jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://192.168.1.136:3306/ ...

  6. link 标签

    link标签 主要是引用外部文件 rel属性 规定当前文档与被链接文档之间的关系 alternate,author,help,icon,licence,next,pingback,prefetch,p ...

  7. 使用IIS应用程序初始化来保持ASP&period;NET应用程序的活动

    https://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET ...

  8. 485&period; Max Consecutive Ones最大连续1的个数

    网址:https://leetcode.com/problems/max-consecutive-ones/ 很简单的一题 class Solution { public: int findMaxCo ...

  9. netty源码理解&lpar;二&rpar; serverstrap&period;bind&lpar;&rpar;

    eventloop是一个线程,里面有一个executor封装了一个线程工厂,在启动的时候启动一个线程,传入的实现了runnable的内部类,里面调用了eventloop的run方法.

  10. Python资源 --Python库

    环境管理 管理 Python 版本和环境的工具 pyenv – 简单的 Python 版本管理工具. Vex – 可以在虚拟环境中执行命令. virtualenv – 创建独立 Python 环境的工 ...