Intent--打开网页
来源:互联网 发布:自动供料机的plc编程 编辑:程序博客网 时间:2024/05/01 06:54
package org.lxh.demo;import android.app.Activity;import android.content.Intent;import android.net.Uri;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class MyIntentCaseDemo extends Activity {private Button mybut = null ;// 按钮组件@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);super.setContentView(R.layout.main);// 默认布局管理器this.mybut = (Button) super.findViewById(R.id.mybut) ;// 取得组件this.mybut.setOnClickListener(new OnClickListenerImpl());// 定义单击事件}private class OnClickListenerImpl implements OnClickListener { @Overridepublic void onClick(View view) {Uri uri = Uri.parse("http://www.mldn.cn") ;// 指定数据Intent it = new Intent() ;// 实例化Intentit.setAction(Intent.ACTION_VIEW);// 指定Actionit.setData(uri) ;// 设置数据MyIntentCaseDemo.this.startActivity(it); // 启动Activity}}}
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/MyLayout"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"><Buttonandroid:id="@+id/mybut"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="打开网页"/></LinearLayout>
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.lxh.demo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MyIntentCaseDemo" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
0 0
- Intent(3)--打开网页
- Intent打开网页
- Intent--打开网页
- 用Intent打开网页
- 使用Intent打开网页
- intent 打开网页
- android 使用intent打开网页
- Android利用Intent如何打开网页
- 在android中通过intent打开网页
- Intent调用手机指定浏览器打开网页
- 使用Intent打开网页和使用手势
- 用意图Intent打开一个网页连接
- 通过Intent自定义动作、打开网页
- Intent对象练习3---使用Intent打开网页
- android Intent打开URL链接(动态打开浏览器网页)
- URI在Intent中的应用,打开网页,拨号,信息等
- 使用android内置Intent打开网页、拨号、打电话
- Android百日程序 开篇章:Intent打开网页
- opentack neutron学习 -- create_network实现
- C#一个消息触发多个并行消息
- Android WebApp 開發教學 (2) – HTML5 Web Storage
- JVM2:Jvm方法区
- [解决]您的服务器不支持 Zlib,这将会导致应用无法安装。请联系您的服务商或者网站...
- Intent--打开网页
- Hibernate 中的悲观锁和乐观锁
- 我也有自己的博客了
- Ubuntu输入法设置
- SQLSERVER如何获取一个数据库中的所有表的名称、一个表中所有字段的名称
- 把git的diff文件打成zip包
- Android row column onSelect background
- JVM3:Jvm堆
- mysql 中使用 concat 函数 拼接字符串