Android注册界面实例代码

 更新时间:2016年9月20日 19:59  点击:2141
有一个注册界面,有四个可填项: 用户名,密码,确认密码,手机号码 我就是想知道,当我填完了四项内容后,点击提交按钮,我所填的内容能保存在应用中,并在再次调到登录界面时能用刚注册的信息成功登录,这是可以实现的吧?

1:代码实现切换操作
2:配置中声明另外一个acitivity

我们先看第一步,这里是触屏处理中的一段代码:

 代码如下 复制代码
public boolean onTouchEvent(MotionEvent event) {
    float pointx = event.getX();
    float pointy = event.getY();
    if (pointx > bp_x + 14 && pointx < bp_x + 14 + 117) {
        if (pointy > bp_y + 43 && pointy < bp_y + 43 + 15) {
        // 帐号
        Intent i = new Intent();// 得到一个意图的实例
        i.putExtra("count", 1);// 写出数据
        i.putExtra("himi", str_zh);
        i.setClass(MainActivity.instance, Register.class);// 设置当前activity以及将要操作的类
        MainActivity.instance.startActivity(i);// 用当前activity来启动另外一个activity
        }
    }
}

显示定义一个intent对象,Intent这个类的机制是协助交互的,详细的说明这里不多讲。

Intent中的putExtra()函数是起到两个activity之间交互交互的作用,这个方法类似 hashtable 或者hashmap中的put,第一个参数是key(索引) ,后一个参数volue(值),根据key我们可以得到对应的volue了。那么后面我也附上接受的处理。

Intent 中的setClass()函数也是传入两个参数,第一个是传入当前实例的activity对象,后面一个参数指需要打开的activity这个类!然后我们就可以利用当前activity对象来启动另外一个activity了。然后我们看下在另外一个activity是如何创建并且怎么接受数据的。

 代码如下 复制代码

package com.himi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

/** * @author Himi **/

public class Register extends Activity {
    private Button button_ok;
    private EditText et;
    private TextView tv;
    private LinearLayout ly;
    private Register rs;
    private byte count;

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        rs = this;
        ly = new LinearLayout(this);
        button_ok = new Button(this);
        button_ok.setWidth(100);
        button_ok.setText("确定");
        button_ok.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
            if (count == 1) {
                MySurfaceView.str_zh = et.getText().toString();
            }
            else if (count == 2) {
                MySurfaceView.str_pass = et.getText().toString();
            }
            rs.finish();
        }
    });

    Intent intent = this.getIntent();
    count = (byte) intent.getIntExtra("count", 0);
    String temp_str = "";
    String temp_str2 = "";
    et = new EditText(this);
    tv = new TextView(this);
    if (count != 3) {
        temp_str = intent.getStringExtra("himi");
        if (count == 1) {
            rs.setTitle("请输入帐号!");
        }
        else {
            rs.setTitle("请输入密码!");
        }
        ly.addView(tv);
        ly.addView(et);
        ly.addView(button_ok);
        if (temp_str != null) {
            et.setText(temp_str);
        }
    }
    else {
        temp_str = intent.getStringExtra("himi_zh");
        temp_str2 = intent.getStringExtra("himi_pass");
        rs.setTitle("您输入的信息:");
        tv.setText("帐号:" + temp_str + "n" + "密码" + temp_str2);
        ly.addView(tv);
        ly.addView(button_ok);
        if (temp_str != null) {
            et.setText(temp_str);
        }
    }
    setContentView(ly);
 }
}

以上代码可以看出,新建一个activity其实只需要继承Activity以及重写onCreate()方法即可。当然创建的还需要一步很重要的步骤,我会在第二步中会详细说明,这里我们看下是如何接受之前的activity传来数据的。

 代码如下 复制代码
Intent intent = this.getIntent();
count = (byte) intent.getIntExtra("count", 0);

接受也是很简明易懂,创建一个Intent 意图对象,调用来去getIntExtra函数得到之前传来的数据,根据key。当然还有getStringExtra()等等函数都是类似,只是根据你传入的数据不同选择不同函数罢了。同学们应该注意的是getIntExtra中第二个参数是什么意思,其实就是一个对于找不到key相匹配的时候会默认return 0;

那么下面介绍第二步:在配置中声明

当创建一个activity的时候我们必须在AndroidMainFeset.xml中去声明我们创建的这个类是个Activity。

今天我来介绍在android手机开发中我们利用Service播放音乐实例,这里需要有一个xml文档列表来存储音乐的地址,然后通过下面的程序读取音乐文件进行播放了。

Android Service 的使用:

我们可以创建一个Android程序,在src目录下创建一个Activity,一个继承自Service类的服务类;同时在资源文件夹res目录下创建一个raw的文件夹存放音频文件,如把music.mp3音乐文件放在该目录下。该程序的主界面如下:

xml布局

 代码如下 复制代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView 
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="Welcome to Andy's blog!"
       android:textSize="16sp"/>  
    <TextView 
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="音乐播放服务"/>
    <Button
       android:id="@+id/startMusic"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="开启音乐播放服务"/>
    <Button
       android:id="@+id/stopMusic"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="停止音乐播放服务"/>
   <Button
      android:id="@+id/bindMusic"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="绑定音乐播放服务"/>
   <Button
      android:id="@+id/unbindMusic"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="解除 ——绑定音乐播放服务"/>
</LinearLayout>

java代码

 代码如下 复制代码

MusicService.java

package com.zeph.android.service;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

public class MusicService extends Service {
 private MediaPlayer mMediaPlayer;

 @Override
 public IBinder onBind(Intent arg0) {
  return null;
 }

 @Override
 public void onCreate() {
  super.onCreate();
  mMediaPlayer = MediaPlayer.create(this, R.raw.music01);
 }

 @Override
 public void onDestroy() {
  super.onDestroy();
  mMediaPlayer.stop();
  mMediaPlayer.release();
 }

 @Override
 public void onStart(Intent intent, int startId) {
  super.onStart(intent, startId);
  int operate = intent.getIntExtra("operate", 3);
  switch (operate) {
  case 0:
   if (!mMediaPlayer.isPlaying()) {
    mMediaPlayer.start();
   }
   break;
  case 1:
   if (mMediaPlayer.isPlaying()) {
    mMediaPlayer.pause();
   }
   break;
  case 2:
   if (mMediaPlayer.isPlaying()) {
    mMediaPlayer.stop();
    mMediaPlayer = MediaPlayer.create(this, R.raw.music01);
   }
   break;
  default:
   break;
  }
 }
}
ServiceTestActivity.java

package com.zeph.android.service;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ServiceTestActivity extends Activity {
 private Button playButton;
 private Button pauseButton;
 private Button stopButton;
 private Button stopService;

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  playButton = (Button) findViewById(R.id.playButton);
  pauseButton = (Button) findViewById(R.id.pauseButton);
  stopButton = (Button) findViewById(R.id.stopButton);
  stopService = (Button) findViewById(R.id.stopService);

  playButton.setOnClickListener(new ButtonOnClickListener());
  pauseButton.setOnClickListener(new ButtonOnClickListener());
  stopButton.setOnClickListener(new ButtonOnClickListener());
  stopService.setOnClickListener(new ButtonOnClickListener());
 }

 public class ButtonOnClickListener implements OnClickListener {

  @Override
  public void onClick(View view) {
   Intent intent = new Intent();
   intent.setClass(getApplicationContext(), MusicService.class);
   if (view == playButton) {
    intent.putExtra("operate", 0);
    startService(intent);
   } else if (view == pauseButton) {
    intent.putExtra("operate", 1);
    startService(intent);
   } else if (view == stopButton) {
    intent.putExtra("operate", 2);
    startService(intent);
   } else if (view == stopService) {
    stopService(intent);
   }
  }
 }
}

服务还需要在AndroidManifest.xml注册后才能使用:

 代码如下 复制代码

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.pocketdigi.service"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".main"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    <service android:enabled="true" android:name=".Music" />
    </application>
</manifest>

本文章来给大家介绍关于android.os.BinderProxy cannot be cast to com解决办法,希望此文章对各位有帮助呀。

Android在绑定服务的时候出现java.lang.ClassCastException:android.os.BinderProxy cannot be cast to com.

修改manifest文件里边相关服务去掉android:process=":remote"即可。

本文章来给大家介绍在安卓手机开发中的常用文件操作代码,这里一个不错的文件操作类,希望对大家有所帮助哦。
 代码如下 复制代码


package cn.youxigu.files;
 
import cn.youxigu.service.*;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.view.*;
 
public class MainActivity extends Activity {
 
    EditText filename;
    EditText content;
    Button   buttonsave;
    Button   buttonopen;
    Button   buttonsaveSdCard;
    Button   buttonopenSdCard;
 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        filename = (EditText)this.findViewById(R.id.filename);
        content  = (EditText)this.findViewById(R.id.content);
        //获取本地保存按钮
        buttonsave   = (Button)this.findViewById(R.id.buttonsave);
        //获取本地打开按钮
        buttonopen   = (Button)this.findViewById(R.id.buttonsaveopen);
 
        //获取SD卡保存按钮
        buttonsaveSdCard   = (Button)this.findViewById(R.id.buttonsavesdcard);
        //获取SD卡打开按钮
        buttonopenSdCard   = (Button)this.findViewById(R.id.buttonsaveopensdcard);
 
 
        buttonsave.setOnClickListener(new SaveFileClick());
 
        buttonopen.setOnClickListener(new OpenFileClick());
 
        buttonsaveSdCard.setOnClickListener(new SaveSdCardFileClick());
 
        buttonopenSdCard.setOnClickListener(new OpenSdCardFileClick());
 
    }
 
 
    /**
     * 保存到本地的存储
     * @author xiaolu
     *
     */    
    private final class SaveFileClick implements View.OnClickListener{
 
        @Override
        public void onClick(View v) {
 
            String files    = filename.getText().toString();
            String contents = content.getText().toString();
 
            FileService file = new FileService(getApplicationContext());
            try{
                file.save(files, contents);
                Toast.makeText(getApplicationContext(), "保存成功", 1).show();
            } catch (Exception e){
                Toast.makeText(getApplicationContext(), "保存失败", 1).show();
                e.printStackTrace();
            }
 
        }
 
    }
 
 
    /**
     * 打开本地的存储
     * @author xiaolu
     *
     */
    private final class OpenFileClick implements View.OnClickListener{
 
        @Override
        public void onClick(View v) {
 
            String filenames    = filename.getText().toString();
 
            FileService file = new FileService(getApplicationContext());
 
            try{
 
                String contents = file.read(filenames);
                //填充到文本框
                content.setText(contents);
 
                Toast.makeText(getApplicationContext(), "打开成功", 1).show();
            } catch (Exception e){
                Toast.makeText(getApplicationContext(), "打开失败", 1).show();
                e.printStackTrace();
            }
 
        }
 
    }
 
 
    /**
     * 保存到SD卡的存储
     * @author xiaolu
     *
     */    
    private final class SaveSdCardFileClick implements View.OnClickListener{
 
        @Override
        public void onClick(View v) {
 
            String files    = filename.getText().toString();
            String contents = content.getText().toString();
 
            FileService file = new FileService(getApplicationContext());
            try{
                file.saveSdCard(files, contents);
                Toast.makeText(getApplicationContext(), "保存到SD卡成功", 1).show();
            } catch (Exception e){
                Toast.makeText(getApplicationContext(), "保存到SD卡失败", 1).show();
                e.printStackTrace();
            }
 
        }
 
    }
 
 
    /**
     * 打开SD卡的存储
     * @author xiaolu
     *
     */
    private final class OpenSdCardFileClick implements View.OnClickListener{
 
        @Override
        public void onClick(View v) {
 
            String filenames    = filename.getText().toString();
 
            FileService file = new FileService(getApplicationContext());
 
            try{
 
                String contents = file.readSdCard(filenames);
                //填充到文本框
                content.setText(contents);
 
                Toast.makeText(getApplicationContext(), "打开SdCard成功", 1).show();
            } catch (Exception e){
                Toast.makeText(getApplicationContext(), "打开SdCard失败", 1).show();
                e.printStackTrace();
            }
 
        }
 
    }
 
}

 


FileService文件代码:
 

 代码如下 复制代码

package cn.youxigu.service;
 
 
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
 
import android.content.Context;
import android.os.Environment;
 
public class FileService {
 
    //获取上下文
    private Context context;
 
    public FileService(Context context){
        this.context = context;
    }
 
    /**
     * 读取本地存储文件内容
     * @param filename 文件名
     * @return 文件内容
     * @throws Exception
     */
 
    public String read(String filename) throws Exception{
 
         FileInputStream InputStream = context.openFileInput(filename);
 
         //申请写入内存
         ByteArrayOutputStream  outStream = new ByteArrayOutputStream();
 
         byte[] buffer = new byte[1024];
 
         int len = 0;
         while((len = InputStream.read(buffer)) != -1){
 
             outStream.write(buffer);
         }
 
         byte[] data = outStream.toByteArray();
 
         return new String(data);
    }
 
 
 
    /**
     * 保存到本地存储
     * @param filename 文件名
     * @param content  文件内容
     * @throws Exception
     */
    public void save(String filename, String content) throws Exception{
        FileOutputStream outStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
 
        outStream.write(content.getBytes());
        outStream.close();      
    }
 
 
    /**
     * 保存到SdCard存储
     * @param filename 文件名
     * @param content  文件内容
     * @throws Exception
     */
    public void saveSdCard(String filename, String content) throws Exception{
 
        //获取SD卡路径
        File sdCardDir = Environment.getExternalStorageDirectory();
 
        File saveFile = new File(sdCardDir, filename);
 
        FileOutputStream outStream = new FileOutputStream(saveFile);
 
        outStream.write(content.getBytes());
 
        outStream.close();
 
    }
 
 
    /**
     * 读取SdCard存储文件内容
     * @param filename 文件名
     * @return 文件内容
     * @throws Exception
     */
 
    public String readSdCard(String filename) throws Exception{
 
        //获取SD卡路径
         File sdCardDir = Environment.getExternalStorageDirectory();
 
         File openFile = new File(sdCardDir, filename);
 
         //用输入流对象进行读取数据
         FileInputStream InputStream = new FileInputStream(openFile);
 
         //申请写入内存
         ByteArrayOutputStream  outStream = new ByteArrayOutputStream();
 
         byte[] buffer = new byte[1024];
 
         int len = 0;
 
         while((len = InputStream.read(buffer)) != -1){
 
             outStream.write(buffer);
         }
 
 
         byte[] data = outStream.toByteArray();
 
         return new String(data);
    }
 
 
 
}

 


main.xml 文件代码:
 

 代码如下 复制代码
<?xml version=“1.0″ encoding=“utf-8″?>
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
    android:layout_width=“fill_parent”
    android:layout_height=“fill_parent”
    android:orientation=“vertical” >
    <TextView
        android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
       
        android:text=“@string/filenametext” />
    <EditText
        android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
        android:id=“@+id/filename”/>
   
    <EditText
        android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
           android:minLines=“3″
           android:id=“@+id/content”/>
    <Button
        android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“@string/buttonsave”
        android:id=“@+id/buttonsave”
        />
   
    <Button
        android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“@string/buttonopen”
        android:id=“@+id/buttonsaveopen”
        />
   
   
    <Button
        android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“@string/buttonsavesdcard”
        android:id=“@+id/buttonsavesdcard”
        />
   
    <Button
        android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“@string/buttonopensdcard”
        android:id=“@+id/buttonsaveopensdcard”
        />
</LinearLayout>
文章主要是介绍关于PC电脑和Android模拟器访问及模拟器之间tcp/udp通信,各位有需要了解同学可进入参考。
Android系统默认只能通过IP(10.0.2.2)单向访问PC电脑,而PC电脑不能通过IP来直接访问Android模拟器系统。要想实现PC电脑和Android模拟器系统以及Android模拟器之间相互通信必须借助端口重定向(redir)来实现。
先说说端口重定向所需要的telnet客户端安装:
windows:
安装telnet客户端。如果没有安装,可以在windows程序管理中的打开或关闭系统功能下找到telnet客户端菜单项来启用telnet客户端功能。
linux:
自行安装telnet客户端。
一、PC电脑不能直接访问Android模拟器系统的原因
Android系统为实现通信将PC电脑IP设置为10.0.2.2,自身为10.0.2.15/127.0.0.1。然而PC电脑并没有为Android模拟器系统指定IP,所以PC只能通过端口重定向来实现和Android模拟器的通信。
二、PC电脑和Android模拟器系统之间通信
1、运行模拟器
2、打开window 命令行,执行:
telnet localhost 5554
5554是模拟器的端口(位于Android模拟器窗口标题栏),执行之后会进入android console
3、在console下执行:
格式:redir add < udp/tcp >:< pc端口 >:< 模拟器端口 >
例如:redir add udp:2888:2888 
     redir add tcp:2888:2888
执行此命令之后,会把PC 2888 端口接收到的tcp/udp数据转到模拟器的2888端口。
三、多个Android模拟器系统之间通信
1、启动模拟器emulator-5554和emulator-5556
2、打开dos窗口执行telnet localhost 5554连接到模拟器5554
3、成功连接后,继续执行:redir add tcp:5000:6000将PC端口5000绑定到模拟器5554的端口6000上。
4、此时模拟器5556通过向PC电脑端口5000(即地址:10.0.2.2:5000)发送tcp/udp数据包跟模拟器5554通信。
5、同理根据步骤2、3来实现PC电脑对模拟器5556的端口转发。
添加成功后,我们可以用redir list命令来列出已经添加的映射端口,redir del可以进行删除。
相信只要理解了PC电脑和Android模拟器系统之间通信,便知道怎么实现多个模拟器之间通信。
 
  • TCP通信
进行TCP通信的时候在本机上启动两个模拟器,本机(PC)和模拟器时发现两个模拟器的IP地址都是完全一样的,所以要实现两个模拟器之间的通信,使用模拟器的IP地址是办不到的。必须进行端口映射。
    模拟器提供了一个特殊的IP,此IP的地址为10.0.2.2,此IP地址可以说等同于PC本机的IP地址127.0.0.1 。所以,通过此特殊IP地址,实现PC本机与模拟器的通信是没有问题。
首先 ,运行模拟器在命令行adb –s emulator -模拟器  forward  tcp:端口号 tcp:端口号(例如:adb –s emulator-5554 forward tcp:8080 tcp:8090)
PC-SERVER:ServerSocket server = new ServerSocket(8080);
模拟器-CLIENT:Socket socket = new Socket("10.0.2.2", 8090);
接下来是如何在两个模拟器之间进行通信:同样的先进行端口映射:adb –s emulator -模拟器  forward  tcp:端口号 tcp:端口号(先运行模拟器).代码如下:
adb –s emulator-5554 forward tcp:8080 tcp:8081
模拟器(5554)-SERVER:ServerSocket server = new ServerSocket(8080);
模拟器(5556)-CLIENT:Socket socket = new Socket("10.0.2.2", 8081);
因为模拟器5556连接的地址10.0.2.2:8080相当于本机的127.0.0.1:8080,由于进行了端口映射本机IP8080上的连接请求都映射到5554:8081上,因此模拟器5556的请求会发送到5554上.
[!--infotagslink--]

相关文章

  • Android子控件超出父控件的范围显示出来方法

    下面我们来看一篇关于Android子控件超出父控件的范围显示出来方法,希望这篇文章能够帮助到各位朋友,有碰到此问题的朋友可以进来看看哦。 <RelativeLayout xmlns:an...2016-10-02
  • 不打开网页直接查看网站的源代码

      有一种方法,可以不打开网站而直接查看到这个网站的源代码..   这样可以有效地防止误入恶意网站...   在浏览器地址栏输入:   view-source:http://...2016-09-20
  • php 调用goolge地图代码

    <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
  • JS基于Mootools实现的个性菜单效果代码

    本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
  • JS+CSS实现分类动态选择及移动功能效果代码

    本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
  • JS实现自定义简单网页软键盘效果代码

    本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
  • php 取除连续空格与换行代码

    php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
  • php简单用户登陆程序代码

    php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p>&nbsp;</p> <p>&nbsp;</p> <form name="form1...2016-11-25
  • Android开发中findViewById()函数用法与简化

    findViewById方法在android开发中是获取页面控件的值了,有没有发现我们一个页面控件多了会反复研究写findViewById呢,下面我们一起来看它的简化方法。 Android中Fin...2016-09-20
  • PHP实现清除wordpress里恶意代码

    公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
  • Android模拟器上模拟来电和短信配置

    如果我们的项目需要做来电及短信的功能,那么我们就得在Android模拟器开发这些功能,本来就来告诉我们如何在Android模拟器上模拟来电及来短信的功能。 在Android模拟...2016-09-20
  • 夜神android模拟器设置代理的方法

    夜神android模拟器如何设置代理呢?对于这个问题其实操作起来是非常的简单,下面小编来为各位详细介绍夜神android模拟器设置代理的方法,希望例子能够帮助到各位。 app...2016-09-20
  • android自定义动态设置Button样式【很常用】

    为了增强android应用的用户体验,我们可以在一些Button按钮上自定义动态的设置一些样式,比如交互时改变字体、颜色、背景图等。 今天来看一个通过重写Button来动态实...2016-09-20
  • js识别uc浏览器的代码

    其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
  • JS实现双击屏幕滚动效果代码

    本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
  • Android WebView加载html5页面实例教程

    如果我们要在Android应用APP中加载html5页面,我们可以使用WebView,本文我们分享两个WebView加载html5页面实例应用。 实例一:WebView加载html5实现炫酷引导页面大多...2016-09-20
  • JS日期加减,日期运算代码

    一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
  • 深入理解Android中View和ViewGroup

    深入理解Android中View和ViewGroup从组成架构上看,似乎ViewGroup在View之上,View需要继承ViewGroup,但实际上不是这样的。View是基类,ViewGroup是它的子类。本教程我们深...2016-09-20
  • PHP开发微信支付的代码分享

    微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
  • Android自定义WebView网络视频播放控件例子

    下面我们来看一篇关于Android自定义WebView网络视频播放控件开发例子,这个文章写得非常的不错下面给各位共享一下吧。 因为业务需要,以下代码均以Youtube网站在线视...2016-10-02