Android简单app开发问题请教 我只是想制作一个app,这个应用只需可以转到指定的网站上。意思就是,打开它可以转到网页即可。请与详细说明。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package com.fansoft.test;import com.fansoft.mgs.*;import java.io.File;import java.io.FileFilter;import android.app.Activity;import android.content.Context;import android.content.Intent;import android.graphics.Bitmap;import android.graphics.Color;import android.os.Bundle;import android.text.TextUtils.TruncateAt;import android.util.Log;import android.view.LayoutInflater;import android.view.View;import android.view.View.OnClickListener;import android.view.ViewGroup;import android.webkit.WebSettings.PluginState;import android.webkit.WebView;import android.widget.AdapterView;import android.widget.AdapterView.OnItemClickListener;import android.widget.BaseAdapter;import android.widget.Button;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.ListView;import android.widget.TextView;public class PlayFlash extends Activity implements OnClickListener { WebView FlashView, FlashView2; String filename, filename2; Button Flash, Flash2, Flash3; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.play_flash); Flash= (Button) findViewById(R.id.ID_PSWF_Flash); Flash.setOnClickListener(this); Flash2= (Button) findViewById(R.id.ID_PSWF_Flash2); Flash2.setOnClickListener(this); Flash3= (Button) findViewById(R.id.ID_PSWF_Flash3); Flash3.setOnClickListener(this); FlashView = (WebView) findViewById(R.id.ID_PSWF_webView); FlashView.getSettings().setPluginState( PluginState.ON ); FlashView.setBackgroundColor( 0); // FlashView.getSettings().setPluginsEnabled(true); FlashView2 = (WebView) findViewById(R.id.ID_PSWF_webView2); FlashView2.getSettings().setPluginState( PluginState.ON ); FlashView2.setBackgroundColor( Color.GREEN);// FlashView2.getSettings().setPluginsEnabled(true); // FlashView.loadUrl("http://www.baidu.com"); // filename = "file://"+Mgs.GetSDCardPath()+"/Arrow.swf";//Log.e("Flash", filename);// FlashView.loadUrl( filename);}public void onClick(View V){// final LinearLayout layout=(LinearLayout)findViewById(R.id.ID_DBoxMain); switch(V.getId()) { case R.id.ID_PSWF_Flash: filename = "file://"+Mgs.GetSDCardPath()+"/fanclt.pipe.swf"; Log.e("Flash", filename); FlashView.loadUrl( filename); filename2= "file://"+Mgs.GetSDCardPath()+"/fanclt.phone.swf";// filename2= "file://www.fansoft.cn/image/swf/fanclt.phone.swf"; Log.e("Flash", filename2); FlashView2.loadUrl( filename2); break; case R.id.ID_PSWF_Flash2: filename = "http://www.fansoft.cn/mob.php"; Log.e("Flash", filename); FlashView.loadUrl( filename); break; case R.id.ID_PSWF_Flash3: filename = "http://www.fansoft.cn/adv/adv.fansel.net.android.php"; Log.e("Flash", filename); FlashView.loadUrl( filename); break; }}}自己看,用WebView很容易实现的.点左上角按钮和左下角按钮就是进入网址, 这是我当时做练习用的. 不好意思的, 2个图片顺序 弄反了, 先是第二个, 点击按钮后,才是地1 个图, 呵呵.这个网站址 不如www.apkbus.com安卓论坛好, 它的图片是直接显示的,不会弄错. Intent intent = new Intent();intent.setData(Uri.parse(sUrl));intent.setAction(Intent.ACTION_VIEW);this.startActivity(intent); //启动浏览器sUrl 就是你要打开的网址 求解!!Android拍照和剪切功能不能使用 关于SQLite的菜鸟级提问~ 求助..关于SQLite中的数据查询.. spinner 更新list数据 问题 求救。。。 android标签问题 求“邮件手机短信通知”思路 触屏手机中的热区死角是什么意思 android 环境配置 HTML5开发手机APP——能播放SWF吗? ListView不显示数据,切换一次tab才显示数据 关于广播接收后处理问题 adb进入数据库命令sqlite3出现 not found
import java.io.File;
import java.io.FileFilter;import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils.TruncateAt;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;public class PlayFlash extends Activity implements OnClickListener
{
WebView FlashView, FlashView2;
String filename, filename2;
Button Flash, Flash2, Flash3; public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.play_flash);
Flash= (Button) findViewById(R.id.ID_PSWF_Flash);
Flash.setOnClickListener(this);
Flash2= (Button) findViewById(R.id.ID_PSWF_Flash2);
Flash2.setOnClickListener(this);
Flash3= (Button) findViewById(R.id.ID_PSWF_Flash3);
Flash3.setOnClickListener(this);
FlashView = (WebView) findViewById(R.id.ID_PSWF_webView);
FlashView.getSettings().setPluginState( PluginState.ON );
FlashView.setBackgroundColor( 0);
// FlashView.getSettings().setPluginsEnabled(true); FlashView2 = (WebView) findViewById(R.id.ID_PSWF_webView2);
FlashView2.getSettings().setPluginState( PluginState.ON );
FlashView2.setBackgroundColor( Color.GREEN);
// FlashView2.getSettings().setPluginsEnabled(true); // FlashView.loadUrl("http://www.baidu.com");
// filename = "file://"+Mgs.GetSDCardPath()+"/Arrow.swf";
//Log.e("Flash", filename);
// FlashView.loadUrl( filename);
}public void onClick(View V)
{
// final LinearLayout layout=(LinearLayout)findViewById(R.id.ID_DBoxMain);
switch(V.getId())
{
case R.id.ID_PSWF_Flash:
filename = "file://"+Mgs.GetSDCardPath()+"/fanclt.pipe.swf";
Log.e("Flash", filename);
FlashView.loadUrl( filename);
filename2= "file://"+Mgs.GetSDCardPath()+"/fanclt.phone.swf";
// filename2= "file://www.fansoft.cn/image/swf/fanclt.phone.swf";
Log.e("Flash", filename2);
FlashView2.loadUrl( filename2);
break;
case R.id.ID_PSWF_Flash2:
filename = "http://www.fansoft.cn/mob.php";
Log.e("Flash", filename);
FlashView.loadUrl( filename);
break;
case R.id.ID_PSWF_Flash3:
filename = "http://www.fansoft.cn/adv/adv.fansel.net.android.php";
Log.e("Flash", filename);
FlashView.loadUrl( filename);
break; }
}
}
自己看,用WebView很容易实现的.
点左上角按钮和左下角按钮就是进入网址, 这是我当时做练习用的.
这个网站址 不如www.apkbus.com安卓论坛好, 它的图片是直接显示的,不会弄错.
Intent intent = new Intent();
intent.setData(Uri.parse(sUrl));
intent.setAction(Intent.ACTION_VIEW);
this.startActivity(intent); //启动浏览器
sUrl 就是你要打开的网址