2019-06-01から1ヶ月間の記事一覧

Androidのスマートフォンに保存しているファイルをGUIで選ぶ

Windowsのファイルを開くダイアログのように、Androidのスマートフォンに保存しているファイルをGUIで選ぶには、暗黙的インテントを使って対応する Activity を起動します。 startActivity() や startActivityForResult() を実行する前に resolveActivityを…

ボタンを押したときに呼ばれる関数をKotlinで設定する

ボタンを押したときに呼ばれる関数を設定するには、このButtonのインスタンスを取得し、setOnClickListener でイベントリスナーを設定します。 <Button android:text="開く" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/open_btn" /> kotlinでは、Buttonのidでインスタンスにアクセスできるので1行で書けます。 override fun onCreate(savedInst</button>…

移行前のブログ

http://d.hatena.ne.jp/poyonshot/

ファイルを開いたときにTextEditorを取得する

VSCodeのエクスプローラでファイルを開いたとき、そのファイルのTextEditorを取得するには、onDidChangeActiveTextEditorを使います。 context.subscriptions.push( vscode.window.onDidChangeActiveTextEditor( (event) => { if (!event || (event.document…