当前位置: 编程技术>移动开发
本页文章导读:
▪筑表语句 建表语句
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 的私有方法
接口定义:
实现定义:
实现里面要想写私有方法,就在里面要写一个和接口一样名字的接口,
@interface Fraction(Private)
other方法就是私有方法了,[self other] 和java的 this.other()差不多;
写main函数测试
frac numerator就类似java的 frac.numerator (getter方法),调用后就会打印私有方法的9啦。。
接口定义:
#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>
最新技术文章: