当前位置:  编程技术>移动开发
本页文章导读:
    ▪筑表语句        建表语句   db.execSQL("create table cs_qw_zhankouwpdetail(" // + "rowguid nvarchar,"// + "zkguid nvarchar,"// 暂扣物品的rowguid + "name nvarchar,"// 物品名称(必填) + "num nvarchar,"// 数量(必填) + "pin.........
    ▪ objective-c 的私有步骤        objective-c 的私有方法 接口定义:#import <Foundation/Foundation.h> @interface Fraction: NSObject{ int numerator; int denominator; } -(void) print; -(void) setNumerator:(int) n; -(void) setDenominator:(int) d; -(int) numerator; -(in.........
    ▪ 简略的Activity跳转 intent       简单的Activity跳转 intent ActivityIntent package com.isoftstone.cry; import java.util.Iterator; import java.util.Set; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import androi.........

[1]筑表语句
    来源: 互联网  发布时间: 2014-02-18
建表语句

 

db.execSQL("create table cs_qw_zhankouwpdetail(" //
				+ "rowguid nvarchar,"//
				+ "zkguid nvarchar,"// 暂扣物品的rowguid
				+ "name nvarchar,"// 物品名称(必填)
				+ "num nvarchar,"// 数量(必填)
				+ "pinpai nvarchar,"// 品牌
				+ "unit nvarchar,"// 商品单位
				+ "des nvarchar"// 备注
				+ ")");
 

    
[2] objective-c 的私有步骤
    来源: 互联网  发布时间: 2014-02-18
objective-c 的私有方法
接口定义:
#import <Foundation/Foundation.h>
@interface Fraction: NSObject{
	int numerator;
	int denominator;
}
-(void) print;
-(void) setNumerator:(int) n;
-(void) setDenominator:(int) d;
-(int) numerator;
-(int) denominator;
@end

实现定义:
#import "Fraction.h"
@interface Fraction(Private)
	-(int) other;
@end
@implementation Fraction

-(int) other{
	return 9;
}

-(void) print{
	
	printf("%i/%i",numerator,denominator);
}
-(void) setNumerator:(int) n{
	numerator = n;
}

-(void) setDenominator:(int) d{
	denominator = d;

}

-(int) denominator{
	return denominator;
}
-(int) numerator{
	
	int cc = [self other];
	printf("this is %d",cc);
	return numerator + cc;
}

实现里面要想写私有方法,就在里面要写一个和接口一样名字的接口,
@interface Fraction(Private)
other方法就是私有方法了,[self other] 和java的 this.other()差不多;


写main函数测试
#import "Fraction.h"

int main(int argc,const char *argv[]){
	Fraction *frac = [[Fraction alloc] init];

[frac setNumerator:1];
[frac setDenominator:3];
printf("the fraction is :");
[frac print];
printf("\n");
[frac numerator];
[frac release];
return 0;

}


frac numerator就类似java的 frac.numerator (getter方法),调用后就会打印私有方法的9啦。。

    
[3] 简略的Activity跳转 intent
    来源: 互联网  发布时间: 2014-02-18
简单的Activity跳转 intent
ActivityIntent
package com.isoftstone.cry;

import java.util.Iterator;
import java.util.Set;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.ToggleButton;

public class ActivityIntent extends Activity 
{
	private Button register , canncel ;
	private EditText username , password ;
	private ToggleButton marriged ;
	private RadioButton male , female ;
	private Spinner position ;
	private CheckBox reading , swimming ;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result1);
		
		//获取实例
		register = (Button)findViewById(R.id.registerBtn);
		canncel = (Button)findViewById(R.id.canncelBtn);
		username = (EditText)findViewById(R.id.userNameEditText);
		password = (EditText)findViewById(R.id.passwordeditText);
		marriged = (ToggleButton)findViewById(R.id.marridedToggleButton);
		male = (RadioButton)findViewById(R.id.maleRadioButton);
		female = (RadioButton)findViewById(R.id.femaleRadioButton);
		position = (Spinner)findViewById(R.id.spinner1);
		reading = (CheckBox)findViewById(R.id.checkBoxReading);
		swimming = (CheckBox)findViewById(R.id.checkBoxSwimming);
		
		//spinner data
		String[] positionData = {"PM","PL","Developer"};
		ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,positionData);
		position.setAdapter(arrayAdapter);
		
		//添加按钮单击事件
		register.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) 
			{
				//向bundle中添加基础信息
				Bundle bundle = new Bundle();
				bundle.putString("username",username.getText().toString());
				bundle.putString("password",password.getText().toString());
				if(male.isChecked()){
					bundle.putString("gender","性别:男");
				}else{
					bundle.putString("gender","性别:女");
				}
				String temp = "爱好:";
				if(reading.isChecked()){
					temp += "阅读";
				}
				if(swimming.isChecked()){
					temp += " ";
					temp += "游泳";
				}
				bundle.putString("hobby",temp);
				if(marriged.isChecked()){
					bundle.putString("marriged","婚否:已婚");
				}else{
					bundle.putString("marriged","婚否:未婚");
				}
				bundle.putString("position",position.getSelectedItem().toString());
				
				//实例化intent,实现跳转
				Intent intent = new Intent(ActivityIntent.this,ActivityIntent2.class);
				intent.putExtra("data",bundle);
				//启动Activity
				startActivity(intent);
			}
		});
	}
}

package com.isoftstone.cry;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.ToggleButton;

public class ActivityIntent2 extends Activity 
{
	private ListView listView ;
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result2);
		//获取listview
		listView = (ListView)findViewById(R.id.listView1);
		//获取intent
		Intent intent = this.getIntent();
		//从intent中获取bundle
		Bundle bundle = intent.getBundleExtra("data");
		//实例化list
		List<String> list = new ArrayList<String>();
		//遍历bundle
		Set<String> set = bundle.keySet();
		Iterator<String> it = set.iterator();
		while (it.hasNext()) 
		{
			String key = it.next();
			list.add(bundle.getString(key));
		}
		//实例化数组适配器
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_checked,list);
		listView.setAdapter(adapter);
	}
}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:collapseColumns="3"
        android:stretchColumns="1" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="userName:" />

            <EditText
                android:id="@+id/userNameEditText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="" >
            </EditText>

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="password:" />

            <EditText
                android:id="@+id/passwordeditText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:password="true" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textViewsex"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="sex:" />

           <RadioGroup android:id="@+id/gender_g"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <RadioButton
                android:id="@+id/maleRadioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="male" />

            <RadioButton
                android:id="@+id/femaleRadioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="female"
                android:checked="true" />
           </RadioGroup>

        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textViewMarry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="marry" />

            <ToggleButton
                android:id="@+id/marridedToggleButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ToggleButton" />

        </TableRow>
        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textViewHobby"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="hobby" />

            <CheckBox
                android:id="@+id/checkBoxSwimming"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="游泳" />

            <CheckBox
                android:id="@+id/checkBoxReading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="阅读" />
			
        </TableRow>
        
        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="position" />

            <Spinner
                android:id="@+id/spinner1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </TableRow>
        
         <TableRow
            android:id="@+id/tableRow7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

             <Button
                 android:id="@+id/canncelBtn"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="canncel" />

             <Button
                 android:id="@+id/registerBtn"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="register" />

        </TableRow>
    </TableLayout>

</LinearLayout>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>

</LinearLayout>

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
WEB前端 iis7站长之家
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3