Skip to content

Instantly share code, notes, and snippets.

@SZooo
SZooo / HandlerTest.java
Last active August 29, 2015 14:05
在学Handler
public class HandlerTest extends Activity{
private Button button ;
private TextView view;
private Handler handler;
protected void onCreat(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.testView);
button = (Button) findViewById(R.id.btn);
@SZooo
SZooo / bigTest.java
Created August 11, 2014 11:03
Get data from the network
public class bigTest extends Activity {
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.big);
btn = (Button) findViewById(R.id.btn);
@SZooo
SZooo / openHelper.java
Last active August 29, 2015 14:05
Test the database operation
public class openHelper extends SQLiteOpenHelper {
private static final int VERSION = 1;
public openHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
public openHelper(Context context,String name){
this(context,name,VERSION);
@SZooo
SZooo / kk.java
Created August 11, 2014 11:14
EditText
public class kk extends Activity {
private EditText edtName;
private EditText edtPas;
private TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@SZooo
SZooo / MainActivity.java
Created August 11, 2014 11:17
变换颜色小试
public class MainActivity extends Activity {
private Button btnn;
private TextView tvv;
private int[] colorArray;
private int colorNum;
private String strColor[];
@Override
protected void onCreate(Bundle savedInstanceState) {
@SZooo
SZooo / Download.java
Last active August 29, 2015 14:05
Http下载测验
package mars.download;
import mars.utils.HttpDownloader;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Download extends Activity {
@SZooo
SZooo / SMSReceiver.java
Created August 13, 2014 07:13
通过代码在类中注册BroadcastReceiver
public class SMSReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
System.out.println("receive message");
//接受Intent对象当中的数据
Bundle bundle = intent.getExtras();
//在Bundle对象当中有一个属性名为pdus,这个属性的值是一个Object数组
@SZooo
SZooo / WifiActivity.java
Last active August 29, 2015 14:05
wifi管理
public class WifiActivity extends Activity {
/** Called when the activity is first created. */
private Button startButton = null;
private Button stopButton = null;
private Button checkButton = null;
private WifiManager wifiManager = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
@SZooo
SZooo / SocketActivity.java
Created August 19, 2014 10:13
Android socket practice
public class SocketActivity extends Activity {
/** Called when the activity is first created. */
private Button startButton = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startButton = (Button)findViewById(R.id.startListener);
startButton.setOnClickListener(new StartSocketListener());
}
@SZooo
SZooo / post
Created August 28, 2014 11:40
android http协议post请求方式 (不完整示例)
private Button button1,button2,button3;
private TextView textView1;
button1.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
//URLַ
// String uriAPI = "http://www.dubblogs.cc:8751/Android/Test/API/Post/index.php";
String uriAPI = "http://172.20.0.206:8082//TestServelt/login.do";