編輯:關於Android編程
package com.jkxqj.helloandroid; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.DatePicker; public class MainActivity extends Activity { private DatePicker datePicker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); datePicker = (DatePicker)findViewById(R.id.firstDatePicker); datePicker.updateDate(2013, 8, 23); } class ButtonListener implements OnClickListener{ @Override public void onClick(View v) { int y = datePicker.getYear(); int m = datePicker.getMonth(); int d = datePicker.getDayOfMonth(); System.out.println("y:" + y + ",m" + m + ",d:" + d); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } package com.jkxqj.helloandroid; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.DatePicker; public class MainActivity extends Activity { private DatePicker datePicker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); datePicker = (DatePicker)findViewById(R.id.firstDatePicker); datePicker.updateDate(2013, 8, 23); } class ButtonListener implements OnClickListener{ @Override public void onClick(View v) { int y = datePicker.getYear(); int m = datePicker.getMonth(); int d = datePicker.getDayOfMonth(); System.out.println("y:" + y + ",m" + m + ",d:" + d); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <AnalogClock android:id="@+id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="64dp" /> <DatePicker android:id="@+id/firstDatePicker" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/clock" android:layout_centerHorizontal="true" android:layout_marginTop="17dp" />
</RelativeLayout>
(1)選用radioGroup的圖標 (2)控制的類是 package com.lc.radiobutt
客戶端通常可以使用Socket的構造器來鏈接到指定的服務器。 下面演示一下,Android端鏈接到服務器,同時,用服務器給Android發送一條消息: 1)
在andorid端使用sqlite數據庫是經常的事,通常來說都是對每個屬性對應一個字段,然後分字段的來讀取,但是今天我要說的不是這樣的。我們通過對象序列化來存取。因為一個
本文為大家分享了android微信支付源碼,供大家參考,具體內容如下參數配置public static final String APP_ID ;/**在微信開放平台注冊