STG板にはアンチケイブ気違いが住み着いています。
先月のエントリで砦スレで暴れていた自演気違いと同一人物だという証明を行いました。
さて、今月のSTG板の書き込みを抽出してみます。
| 時間帯 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010/07/01(木) | 3 | 2 | ||||||||||||||||||||||
| 2010/07/02(金) | 1 | 1 | 2 | 1 | ||||||||||||||||||||
| 2010/07/03(土) | 1 | 1 | 7 | 1 | 1 | |||||||||||||||||||
| 2010/07/04(日) | 3 | 1 | ||||||||||||||||||||||
| 2010/07/05(月) | 1 | 4 | 2 | |||||||||||||||||||||
| 2010/07/06(火) | 1 | 1 | ||||||||||||||||||||||
| 2010/07/07(水) | 1 | 1 | ||||||||||||||||||||||
| 2010/07/08(木) | 1 | |||||||||||||||||||||||
| 2010/07/09(金) | ||||||||||||||||||||||||
| 2010/07/10(土) | ||||||||||||||||||||||||
| 2010/07/11(日) | 1 | 2 | ||||||||||||||||||||||
| 2010/07/12(月) | 1 | 1 | ||||||||||||||||||||||
| 2010/07/13(火) | 5 | 1 | 2 | |||||||||||||||||||||
| 2010/07/14(水) | 2 | |||||||||||||||||||||||
| 2010/07/15(木) | 2 | 1 | 3 | 2 | 1 | 4 | ||||||||||||||||||
| 2010/07/16(金) | 4 | 4 | 2 | 1 | 2 | 4 | 3 | 2 | 2 | 1 | ||||||||||||||
| 2010/07/17(土) | 8 | 2 | 1 | 3 | ||||||||||||||||||||
| 2010/07/18(日) | 1 | 1 | 4 | 2 | 1 | 1 | ||||||||||||||||||
| 2010/07/19(月) | ||||||||||||||||||||||||
| 2010/07/20(火) | 9 | |||||||||||||||||||||||
| 2010/07/21(水) | 2 | 1 | 1 | 8 | 6 | 1 | ||||||||||||||||||
| 2010/07/22(木) | 1 | 1 | 2 | 2 | 3 | |||||||||||||||||||
| 2010/07/23(金) | 2 | 1 | 1 | 3 | 2 | |||||||||||||||||||
| 2010/07/24(土) | 5 | 1 | 2 | 1 | ||||||||||||||||||||
| 2010/07/25(日) | 1 | 2 | 2 | |||||||||||||||||||||
| 2010/07/26(月) | 1 | 4 | 2 | 1 | ||||||||||||||||||||
| 2010/07/27(火) | 1 | 1 | 1 | |||||||||||||||||||||
| 2010/07/28(水) | 2 | 3 | ||||||||||||||||||||||
| 2010/07/29(木) | 1 | 4 | 1 | 1 | 1 | |||||||||||||||||||
| 2010/07/30(金) | 1 | 4 | 1 | |||||||||||||||||||||
| 2010/07/31(土) | 1 | 3 |
例によって砦スレの書き込みと合体してみます。
| 時間帯 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010/07/01(木) | 4 | 3 | 2 | 2 | 1 | 3 | 1 | 1 | 1 | 4 | 2 | |||||||||||||
| 2010/07/02(金) | 2 | 2 | 2 | 1 | 1 | 2 | 1 | 1 | ||||||||||||||||
| 2010/07/03(土) | 1 | 1 | 1 | 1 | 1 | 9 | 1 | 2 | 4 | 5 | 3 | |||||||||||||
| 2010/07/04(日) | 1 | 1 | 2 | 2 | 1 | 4 | 3 | 8 | 4 | 8 | 12 | 9 | 7 | |||||||||||
| 2010/07/05(月) | 7 | 4 | 4 | 2 | 4 | 1 | 2 | 1 | 2 | 15 | 14 | |||||||||||||
| 2010/07/06(火) | 14 | 7 | 7 | 3 | 2 | 12 | 1 | 3 | 3 | 2 | 1 | 1 | 4 | 20 | 22 | |||||||||
| 2010/07/07(水) | 10 | 13 | 3 | 1 | 1 | |||||||||||||||||||
| 2010/07/08(木) | 1 | |||||||||||||||||||||||
| 2010/07/09(金) | ||||||||||||||||||||||||
| 2010/07/10(土) | ||||||||||||||||||||||||
| 2010/07/11(日) | 1 | 2 | ||||||||||||||||||||||
| 2010/07/12(月) | 1 | 1 | ||||||||||||||||||||||
| 2010/07/13(火) | 5 | 1 | 2 | |||||||||||||||||||||
| 2010/07/14(水) | 2 | |||||||||||||||||||||||
| 2010/07/15(木) | 2 | 1 | 3 | 2 | 1 | 4 | ||||||||||||||||||
| 2010/07/16(金) | 4 | 4 | 2 | 1 | 2 | 4 | 3 | 2 | 2 | 1 | ||||||||||||||
| 2010/07/17(土) | 8 | 2 | 1 | 3 | ||||||||||||||||||||
| 2010/07/18(日) | 1 | 1 | 4 | 2 | 1 | 1 | ||||||||||||||||||
| 2010/07/19(月) | ||||||||||||||||||||||||
| 2010/07/20(火) | 9 | |||||||||||||||||||||||
| 2010/07/21(水) | 2 | 1 | 1 | 8 | 6 | 1 | ||||||||||||||||||
| 2010/07/22(木) | 1 | 1 | 2 | 2 | 3 | |||||||||||||||||||
| 2010/07/23(金) | 2 | 1 | 1 | 3 | 2 | |||||||||||||||||||
| 2010/07/24(土) | 5 | 1 | 2 | 1 | ||||||||||||||||||||
| 2010/07/25(日) | 1 | 2 | 2 | |||||||||||||||||||||
| 2010/07/26(月) | 1 | 4 | 2 | 1 | ||||||||||||||||||||
| 2010/07/27(火) | 1 | 1 | 1 | |||||||||||||||||||||
| 2010/07/28(水) | 2 | 3 | ||||||||||||||||||||||
| 2010/07/29(木) | 1 | 4 | 1 | 1 | 1 | |||||||||||||||||||
| 2010/07/30(金) | 1 | 4 | 1 | |||||||||||||||||||||
| 2010/07/31(土) | 1 | 3 |
燃え尽き症候群から見事に復活する様がよくわかります。
しかし相変わらず行動パターンが変わっていませんね。
目覚めて一番にすることがスレのチェックとか残念な人生だ。
ゲームハード・業界版およびゲームサロン、「【XBOX360】箱○は2DSTGの最後の砦」スレに住み着いていた気違いを見守ってみる2010年7月版。
前回までのあらすじはここらへんを参照。
http://yuubiseiharukana.blog.shinobi.jp/Entry/313/
http://yuubiseiharukana.blog.shinobi.jp/Entry/326/
http://yuubiseiharukana.blog.shinobi.jp/Entry/327/
http://yuubiseiharukana.blog.shinobi.jp/Entry/328/
要は一日中2ちゃんねるに張り付いている一人の気違いについて纏めてみたものです。
ゲハ崩壊後ゲサロに移動した砦スレですが、6月末にfusiana祭りがあり、その後ますます発狂して手がつけられなくなったので7日の午前2時にシベリア超速報に移動しました。
シベリアは書き込みのIPアドレスが表示されるという大きな特徴がある板です。
どうなったか見てみましょう。
ちなみにゲサロの末期は新生ゲハからの愉快犯が紛れ込んでいたのでカウントが多少多くなっている可能性があります。
| 時間帯 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010/07/01(木) | 4 | 3 | 2 | 2 | 1 | 1 | 1 | 1 | 2 | 2 | ||||||||||||||
| 2010/07/02(金) | 1 | 1 | 1 | 2 | 1 | 1 | ||||||||||||||||||
| 2010/07/03(土) | 1 | 1 | 1 | 2 | 1 | 4 | 5 | 3 | ||||||||||||||||
| 2010/07/04(日) | 1 | 1 | 2 | 2 | 1 | 1 | 2 | 8 | 4 | 8 | 12 | 9 | 7 | |||||||||||
| 2010/07/05(月) | 6 | 4 | 4 | 2 | 4 | 1 | 2 | 1 | 2 | 11 | 12 | |||||||||||||
| 2010/07/06(火) | 14 | 7 | 7 | 3 | 2 | 11 | 1 | 3 | 3 | 2 | 1 | 1 | 3 | 20 | 22 | |||||||||
| 2010/07/07(水) | 10 | 13 | 3 | |||||||||||||||||||||
| 2010/07/08(木) | ||||||||||||||||||||||||
| 2010/07/09(金) | ||||||||||||||||||||||||
| 2010/07/10(土) | ||||||||||||||||||||||||
| 2010/07/11(日) | ||||||||||||||||||||||||
| 2010/07/12(月) | ||||||||||||||||||||||||
| 2010/07/13(火) | ||||||||||||||||||||||||
| 2010/07/14(水) | ||||||||||||||||||||||||
| 2010/07/15(木) | ||||||||||||||||||||||||
| 2010/07/16(金) | ||||||||||||||||||||||||
| 2010/07/17(土) | ||||||||||||||||||||||||
| 2010/07/18(日) | ||||||||||||||||||||||||
| 2010/07/19(月) | ||||||||||||||||||||||||
| 2010/07/20(火) | ||||||||||||||||||||||||
| 2010/07/21(水) | ||||||||||||||||||||||||
| 2010/07/22(木) | ||||||||||||||||||||||||
| 2010/07/23(金) | ||||||||||||||||||||||||
| 2010/07/24(土) | ||||||||||||||||||||||||
| 2010/07/25(日) | ||||||||||||||||||||||||
| 2010/07/26(月) | ||||||||||||||||||||||||
| 2010/07/27(火) | ||||||||||||||||||||||||
| 2010/07/28(水) | ||||||||||||||||||||||||
| 2010/07/29(木) | ||||||||||||||||||||||||
| 2010/07/30(金) | ||||||||||||||||||||||||
| 2010/07/31(土) |
見てのとおり、自演気違いは本気で一人だったという実に清々しい結果となりました。
その後もゲハやゲサロ、シューティング板で暴れているのですが、ブログ主(つまり私)は轟音だ、とか吠える人がやたらいっぱいいるわりに、シベリアやここに直接言いに来る人が一人もいないのがわかりやすいですね。
今回はデータベースを使用してみます。
SQLiteが使用できるようです。
まずはBizCardひとりぶんのデータを保持するクラスを作ります。
単にプロパティ名とそれに対応するDBカラム名、セッターゲッターを書いただけです。
setter/getterを一個一個作るのは馬鹿みたいなので、「ソース」→「toString()の生成」から自動で作ってもらいます。
/src/com.example.bizcard/db/BizCard.java
public class BizCard implements Serializable{
//バージョン
private static final long serialVersionUID = 1;
// テーブル名
public static final String TABLE_NAME = "biz_card";
// カラム名
public static final String COLUMN_ID = "_id";
public static final String COLUMN_PERSON_NAME = "person_name";
public static final String COLUMN_COMPANY_NAME = "company_name";
public static final String COLUMN_ORGANIZATION_NAME = "organization_name";
public static final String COLUMN_POSITION_NAME = "position_name";
public static final String COLUMN_ZIP_CODE = "zip_code";
public static final String COLUMN_ADDRESS = "address";
public static final String COLUMN_TEL1 = "tel1";
public static final String COLUMN_TEL2 = "tel2";
public static final String COLUMN_MAIL = "mail";
// プロパティ
private Long rowid = null;
private String personName = null;
private String organizationName = null;
private String companyName = null;
private String positionName = null;
private String zipCode = null;
private String address = null;
private String tel1 = null;
private String tel2 = null;
private String mail = null;
//setter/getter
public Long getRowid() {
return rowid;
}
public void setRowid(Long rowid) {
this.rowid = rowid;
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getPositionName() {
return positionName;
}
public void setPositionName(String positionName) {
this.positionName = positionName;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTel1() {
return tel1;
}
public void setTel1(String tel1) {
this.tel1 = tel1;
}
public String getTel2() {
return tel2;
}
public void setTel2(String tel2) {
this.tel2 = tel2;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
/*
* toStringをオーバーライド
* 何故氏名+会社名だけかは謎
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append( getPersonName());
if( getCompanyName() != null){
builder.append(":");
builder.append(getCompanyName());
}
return builder.toString();
}
}
SerializableはserialVersionUIDを定義しないと怒られます。
これは、BizCardのデータをエクスポートするときにバージョン情報も付記しておき、その後インポートしたときにデータ構造がバージョンアップされていたら警告する、みたいな機能です。
エクスポートインポート機能を備えたアプリなら重要かもしれません。
元のエントリでは@SuppressWarnings("serial")でエラーの発生を抑えていますが、こっちではとりあえず1で。
まあ今後バージョンアップする予定もありませんが。
こえでおしごと! 4 紺野 あずれ
☆☆☆☆☆
着エロの頂点、こえでおしごと最新刊。
前巻アレだったのでバレるのも時間の問題と思いきやいきなり一話でバレた。
成り行きで表紙のように二人も声優やることに、とまあ予想通りの展開。
今巻はこれまでの羞恥責めにラブコメ分が追加されてそっち方面でも大満足です。
しかし柑奈が自宅では色気の欠片もないジャージというのはポイント高いな。
でもスタジオに制服で行くのはやめてあげて。
知らなかったふりできないじゃん。
そういやまだDVD見てなかった。
アイドルマスターNeue Green for ディアリースターズ1 黒瀬 浩介
☆☆☆☆
男らしくなるためにアイドルデビュー、という根本的に間違っているまさかの公式男の娘涼ちんのコミカライズ。
涼が完全に女性として描かれてるのが少々気になりますがまあそれもよし。
つうか真が格好良すぎるな。
比較的テンポがよく、ゴミばかりの二次創作の中ではかなりレベルの高い作品ではないかと。
「慣れる」が一部「馴れる」と誤字ってるのが気になった。
そういやアイマスDSやったことなかった。
一年生になっちゃったら6 大井 昌和
☆☆☆
なんかもう元に戻る気全く無いだろお前。
という裸満載なのにエロさを感じない健康女児を描かせたら天下一品の大井昌和最新刊。
といってもストーリーが何も進展しないので特に感想書くこともないな。
乃木坂春香の秘密12 五十嵐 雄策
☆☆☆
あれだけフラグ立てまくっておいてぽっきりとか非道にも程がある。
ということで歩くフラグ製造機だった主人公がようやくひとつの決断を下すことに成功した回。
というかそんなことより今まで無自覚だったということが恐ろしいのだが。
あといつもの思わせぶりな伏線張りが、今回は回収されていません。
システムアーキテクト「専門知識+午後問題」の重点対策 岡山 昌二
前買ったやつは単なる問題集だったことが発覚したので基礎知識がないのに読めねーよと。
いうことで午前2と午後の基礎知識本。
重点対策シリーズはなんとなくだが良書だと思う。
「Kinect」は150ドル-ITmedia Gamez via kwout
お高めで少々残念。
性能を考えれば安いと言っていいと思いますが、家庭用ゲーム機の周辺機器としてはちょっとこの値段ではね。
もうすこしがんばって99ドル(日本9800円)にしてほしかったところ。
まあDanceMastersが出るから仕方なく買うんですけどね。
しかしこのITMediaの記事切り抜き機能凄いな。
前回の続き。
http://codezine.jp/article/detail/4657?p=2
マップ画面のデザインを行いましょう。
Androidエミュレータをインストールすると、Documents and Settings以下にいつのまにかGoogleMapAPI用の証明書が保存されているようです。
C:\Documents and Settings\ユーザ名\.android\debug.keystoreがあるかどうか探してみましょう。
見つかったら、その証明書からフィンガープリントを抽出します。
keytoolはJavaに付属してるみたい。
手元ではC:\pleades\jre1.6\binに見つかりました。
keytool -list -keystore "C:\Documents and Settings\ユーザ名\.android\debug.keystore"
を実行します。
パスワードは何も入れずにリターン。
:で区切られたMD5が取得できます。
このパスワードはどういう意味かよくわかんない。
次にここからMD5を入力すると、APIキーとMapViewのコードを取得できます。
http://code.google.com/intl/ja/android/add-ons/google-apis/maps-api-signup.html
以後はMapViewのコードをビューにそのまま書くだけで簡単にGoogleMapAPIを利用できるようになります。
/res/layout/map.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<!-- 地図 -->
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0PvsHuDZcbz3WPMOPTMG2N02xrRdJDF5pX2YsWQ" />
<!-- 地図の上に半透明のレイアウトを配置 -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#99000080"
android:padding="2px" >
<!-- 地図切り替えのラジオボタン -->
<RadioGroup
android:id="@+id/mapRadioGroup"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- 通常の地図ボタン -->
<RadioButton
android:id="@+id/normalMapRadio"
android:text="@string/map"
android:textColor="#FFFFFFFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- 衛星写真ボタン -->
<RadioButton
android:id="@+id/satelliteMapRadio"
android:text="@string/map_satellite"
android:textColor="#FFFFFFFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RadioGroup>
<!-- 現在地表示のトグルボタン -->
<ToggleButton
android:id="@+id/currentLocationToggle"
android:layout_gravity="right|center_vertical"
android:textOff="@string/current_location_off"
android:textOn="@string/current_location_on"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
<FrameLayout>は、部品を並べると単純に画面左上詰めで追加するという最もシンプルなレイアウトです。
今回の場合、まずMapViewで全画面にマップを表示し、その後LinearLayoutを重ねるということになります。
LinearLayoutはandroid:orientation="horizontal"が指定されているので、中にあるふたつの部品、RadioGroupとToggleButtonが左右に並んで表示されます。
背景色はandroid:background="#99000080"となっていますが、指定方法は"#aarrggbb"、"#rrggbb"です。aaは透明度。
/src/com.example.bizcard/ListActivity.java
public class MapActivity extends com.google.android.maps.MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
これまでアクティビティはすべてandroid.app.Activityクラスを継承していましたが、GoogleMapAPIを利用するアクティビティはcom.google.android.maps.MapActivityを継承する必要があります。
onCreateは全く同じですが、isRouteDisplayedという謎メソッドが追加されています。
ルート表示を行うならtrueだそうですが何のことやら、とりあえずfalseにしておきます。
最後にマニフェストを追加。
/AndroidManifest.xml
<activity android:name=".MapActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>
ここまでは同じですが、GoogleMapに接続するためにインターネット接続権限を付与しないといけません。
<application>の外側、<manifest>の直下に設置します。
<uses-permission android:name="android.permission.INTERNET" />
また、GoogleMapAPIを使用しているのでそれを宣言して取り込まないといけないようです。
こちらは<application>直下に記述します。
<uses-library android:name="com.google.android.maps" />
何故書くレベルが違うんだ?
どっちもアプリ単位とかアクティビティ単位じゃ駄目なのか?
実行。
無事にマップの取得に成功。
ボタンやドラッグなどの機能は何も実装していないので、現状では見るだけです。
Androidの記事
クラブニンテンドーオリジナルグッズ、スーパーマリオギャラクシー2オリジナルサントラが届きました。
500ポイントで2枚組とは豪気だね。
論理少女4 つじ 要
☆☆☆
今回はなんか有名どころのネタとかただのクイズとかばっかりで、これはというような問題はありませんでした。
そのぶん展開はまあ面白かったのでまあよし。
しかしこの一巻でひとつの区切りというスタイルは意識してやってるんですかね。
打ち切りみたいに無理矢理詰め込むのは勘弁ですが、本作のように自然に纏めるのは読む方としてもありがたいのでどんどんやってほしいですね。
わびれもの 小坂 俊史
☆☆☆
かの小坂氏が秘境駅とか美川ムーバレーとかおおざわの石仏の森とかの名スポット珍スポットを巡ったエッセイ。
せんせいになれませんみたいなはっちゃけ風ではなく、一見熱い感じなのになんとなく中央モノローグ線的な寂寥感を感じる不思議な温度の紀行文となっています。
エスパー魔美 2 (藤子・F・不二雄大全集) 藤子・F・不二雄
☆☆☆
死亡確認をしない殺し屋とかおかしいですから!
基本的に身近な話題に終始している本作ですが、2巻では突然殺し屋と対峙します。
さすがにちょっと話が大きくなりすぎだろ。
あと銃弾を止めるとかそのブローチは何でできてるんだと。
ドラえもんのような荒唐無稽ものとちがい、地に足のついているエスパー漫画でこの話は、少々スケール感を間違っている気がしました。
映画 風の谷のナウシカ GUIDEBOOK 復刻版(ロマンアルバム)
☆☆☆
てっきりロマンアルバムエクストラのほうの復刻かと思ったら違うじゃないか。
内容は1984年発売の復刻版だけあってさすがに古いです。
CG?デジタル?なにそれ?みたいな。
コミックもまだ2巻までしか出ていないようです。
オニデレ7 クリスタルな洋介
☆☆☆
謎の美少女アンジーが登場してますます混迷する恋模様や如何にってかどうすんだよこの展開。
いやもう収拾付けてくれよ、とか思ってたら作者自ら言ってやがる。
残念ながらモモはあまり活躍しません。
あと表紙の鬼照中が自慰中に見えた俺はもう駄目だ。
http://www.itmedia.co.jp/news/articles/1007/16/news075.html
> pixivへのアクセスのうち、IE6からは約6%と利用が減っているほか、
> リニューアル後にIE6でpixivを利用すると、
> JavaScriptとCSSが正常に動かない可能性があり、
> 「対応するにはコストがかかりすぎる」(片桐孝憲社長)と判断。
> 最新バージョンへのアップグレードを呼び掛けた。
羨ましい。
弱小下請けにはそんな自由は無いのであった。
先日Mac版IEに対応させろとか言われたときはどうしようかと思った。
/res/layout/show.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"> <LinearLayout android:orientation="vertical" android:layout_marginLeft="10dip" android:layout_marginTop="20dip" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- 会社名 --> <TextView android:id="@+id/companyNameLabel" android:text="@string/company_name" android:textSize="19dip" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!-- 組織名 --> <TextView android:id="@+id/organizationNameLabel" android:text="@string/organization_name" android:layout_marginLeft="10dip" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <!-- 役職名 --> <TextView android:id="@+id/positionNameLabel" android:text="@string/position_name" android:layout_marginLeft="10dip" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> <LinearLayout android:orientation="vertical" android:layout_marginTop="40dip" android:layout_marginRight="20dip" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!-- 人名 --> <TextView android:id="@+id/personNameLabel" android:text="@string/person_name" android:textSize="25dip" android:gravity="right" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <!-- 住所 --> <TextView android:id="@+id/addressLabel" android:text="@string/address" android:textSize="20dip" android:layout_marginLeft="10dip" android:gravity="right" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <!-- 電話1 --> <TextView android:id="@+id/tel1Label" android:text="@string/tel1" android:autoLink="phone" android:textSize="20dip" android:gravity="right" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <!-- 電話2 --> <TextView android:id="@+id/tel2Label" android:text="@string/tel2" android:autoLink="phone" android:gravity="right" android:textSize="20dip" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <!-- メール --> <TextView android:id="@+id/mailLabel" android:text="@string/mail" android:autoLink="email" android:textSize="20dip" android:gravity="right" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout>
/src/com.example.bizcard/ShowActivity.java
public class ShowActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show);
}
}
/AndroidManifest.xml
<activity android:name=".ShowActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>
前回とほぼ同じです。
show.xmlはandroid:textSizeやandroid:layout_marginLeftなんかを使用してデザイン性がアップしています。
Eclipseのレイアウトエディタだと何故かうまく表示されません。
これに限らず、複雑なデザインをするとレイアウト表示では崩れてしまうようです。
↑Eclipse
↑エミュレータ
どうやってデバッグすればいいんだ。
毎回実機に送り込んで確認しないといけないのか?
Androidの記事
前回の続き。
これまでずっとアクティビティひとつで完結するアプリしか作っていませんでした。
複数アクティビティに挑戦してみます。
まずはビュー。
/res/layout/regist.xml
<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="1" android:shrinkColumns="1"> <!-- 名前 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/person_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/personNameText" android:layout_span="2" android:hint="@string/required" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 会社 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/company_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/companyNameText" android:layout_span="2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 部署 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/organization_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/organizationNameText" android:layout_span="2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 役職 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/position_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/positionNameText" android:layout_span="2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 郵便番号 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/zip_code" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> <EditText android:id="@+id/zipCodeText" android:minWidth="100dip" android:inputType="phone" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 住所 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/address" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/addressText" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageButton android:id="@+id/mapButton" android:src="@drawable/map" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <!-- 電話1 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/tel1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/tel1Text" android:layout_span="2" android:inputType="phone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </TableRow> <!-- 電話2 --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/tel2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/tel2Text" android:layout_span="2" android:inputType="phone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </TableRow> <!-- メール --> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="@string/mail" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/mailText" android:layout_span="2" android:inputType="textEmailAddress" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> </TableLayout>当初自力でやろうと思ってたんだがめんどくさすぎたので結局コピペになった。
もう少しどうにかならんのか。
ビューはデフォルトでは全体を<LinearLayout>で囲まれますが、これを<TableLayout>に変更します。
LinearLayoutは一行にひとつの要素を記述する、まさにメニュー用途向けのレイアウトですが、逆に複雑なレイアウトは表示できません。
TableLayoutはHTMLの<table>とほぼ同じで、<tr>に相当する<TableRow>で行を指定し、中に各部品を配置していきます。
android:layout_spanはcolspanです。
rowspanは無いみたい?
android:inputTypeは入力文字種を指定できます。
"phone"であれば数値、"textPassword"であればパスワード等。
これを設定するとソフトウェアキーボードも自動的に変わったりします。
"textPersonName"とか"textPostalAddress"とかまであるみたいなんだがどう使うんだそれ。
android:hintは未入力時に表示されるヒントです。
カーソルを合わせると削除されます。
HTMLだとこの機能はJavaScriptで実装するしかないのですが、Androidでは予め用意されています。
ビューに配置されている@stringを設定。
/res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BizCard</string>
<string name="person_name">名前</string>
<string name="company_name">会社</string>
<string name="organization_name">組織</string>
<string name="position_name">役職</string>
<string name="zip_code">郵便番号</string>
<string name="address">住所</string>
<string name="tel1">電話1</string>
<string name="tel2">電話2</string>
<string name="mail">メール</string>
<string name="required">必須</string>
<string name="map">地図</string>
<string name="map_satellite">衛星写真</string>
<string name="current_location_on">現在地を中央に表示</string>
<string name="current_location_off">現在地を中央に表示</string>
</resources>
住所のところに<ImageButton android:src="@drawable/map">というのがありますが、これは画像ファイルです。
/res/drawableフォルダに画像を登録し、そのファイル名を指定することで画像表示が行えます。
拡張子は指定しないようです。
map.pngとmap.jpgがあったらどうするんだろうと思ったが登録できないみたい。
デフォルトではdrawable-hdpi、drawable-mdpi、drawable-ldpiといったフォルダがありますが、高解像度用、中解像度用、低解像度用の画像を入れておくと自動で出し分けされます。
drawableフォルダは該当解像度の画像が見つからなかった場合のデフォルトになります。
ようやく素材が完成したので次はアクティビティを作成します。
/src/com.example.bizcard/RegistActivity.java
package com.example.bizcard;
import android.app.Activity;
import android.os.Bundle;
public class RegistActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.regist);
}
}
例によってpackageやimportはIDEが勝手にやってくれます。
ListActivityと違うところは、最後のsetContentViewのターゲットがR.layout.registになっています。
これによって/res/layout/regist.xmlがビューとして使用されることになります。
最後にAndroidManifest.xmlを記述します。
いくらアクティビティを作成しても、AndroidManifest.xmlに記述しないかぎり無かったもの扱いになるようです。
<application>内に今回作成したアクティビティを追加します。
/AndroidManifest.xml
<activity android:name=".RegistActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity>
<intent-filter>って何?というところですが、外部アプリから起動される際の関連付けの設定などを行うようです。
中でも特に、<action android:name="android.intent.action.MAIN" />を設定したアクティビティは、ランチャーから直接起動したときに実行されるアクティビティになります。
ところで現在ListActivityとRegistActivityの両方に<action android:name="android.intent.action.MAIN" />が設定される事態となっておりますが、この場合どちらが優先されるかはコンパイル時に決められます。
「実行」→「実行構成」→「LaunchAction」から指定を行えます。
ここをRegistActivityにし、実行すると無事入力画面が表示されました。
Androidの記事
