2014-09-25から1日間の記事一覧

Jsoupを使ってみた

File input = new File("/tmp/input.html"); Document doc = Jsoup.parse(input, "UTF-8", "http://example.com/"); Elements links = doc.select("a[href]"); // a with href Elements pngs = doc.select("img[src$=.png]"); // img with src ending .png E…

AndroidManifest.xmlで最初に呼ばれる画面の指定

AndroidManifest.xmlの中で複数画面が存在するときは、下記のコードを追加する事で、そのactivityが最初に呼ばれます。 <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> サンプル

アプリ起動時にスプラッシュ画面を表示させる

1 splash.xmlを作成 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > </linearlayout>

マルチスレッドのidを確認

下記の書き方でスレッドのidを取得できます。 System.out.println(Thread.currentThread().getId()); モバイル開発系(K)-Android開発 Tips マルチスレッドとUIの基本 [Thread, Runnable, Activity.runOnUiThread, View.post]

textview内リンクをタップで別ブラウザ表示

textview内にあるリンクをタップしたときに、 外部のブラウザを起動して表示する。 rssリーダーなどでとってきたxmlの中にある「続きを読む」をタップした時に動作などに使えます。 mytext = (TextView) findViewById(R.id.textView); mytext.setText(Html.f…