今日のメモ
リファクタリングちう。気づきを以下に。
- ロケーションが変わったら emulator から外部への通信ができない件
- 一度 emulator オトさないと駄目な模様
- 昨晩も職場から自宅に戻って試験したら UnknownHostException 吐いた件
- emulator 起動し直したら_emulator: ERROR: the cache image is used by another emulator. aborting_なエラーがナニ
- 再度 emulator 終了してみる
- OSX 自体の挙動が微妙な可能性もあるだけに微妙orz
- 動いた
テキストフィールドへの出力
res/layout/main.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" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>
TextView の定義を以下に変更。
<TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />
これで R.id.text1 で findViewById でプログラム内で捕捉可能。以下なカンジ。
TextView tmp = (TextView)findViewById(R.id.text1); tmp.setText("hello world");
ただ、よく考えてみるに GAE と認証のやりとりをして JSON 文字列なレスポンスが戻ってきてるだけなので、それをなんとかする必要あり。あと文字列なマジックナンバーが存在するので何とかする方向。
で
よく考えたら戻ってきてる JSON な文字列の処理を完全スルーしてるな。今はこんなカンジになってるので
String authKey = getAuthKey(); HttpResponse response = getAppspotContent(authKey, "/");
戻ってきた response で
- JSON 文字列を生成
- JSON オブジェクト生成
という手順で良いのか。
とは言え
今日の日中はこれで打ち止めとなります。mtg 漬け。