- Intent bi = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
- startActivity(bi);

・ダイアル画面を表示する
- Intent di = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:123456789"));
- startActivity(di);

・Google Maps を表示する (Builed Target が Google APIs でないとダメ)
- Intent mi = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=Tokyo"));
- startActivity(mi);

・コンタクトリストを表示する
- Intent cti = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/1"));
- startActivity(cti);

More...

- package org.example.hello;
- import android.app.Activity;
- import android.net.Uri;
- import android.os.Bundle;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- import android.content.Intent;
- public class Hello extends Activity implements OnClickListener{
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- View browserTestButton = this.findViewById(R.id.browsertest_button);
- browserTestButton.setOnClickListener(this);
- View googlemapTestButton = this.findViewById(R.id.googlemaptest_button);
- googlemapTestButton.setOnClickListener(this);
- Button dialButton = (Button)findViewById(R.id.dialtest_button);
- dialButton.setOnClickListener(this);
- Button contactButton = (Button)findViewById(R.id.contacttest_button);
- contactButton.setOnClickListener(this);
- Button closeButton = (Button)findViewById(R.id.close_button);
- closeButton.setOnClickListener(this);
- }
- public void onClick(View v) {
- switch(v.getId()){
- case R.id.browsertest_button:
- Intent bi = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
- startActivity(bi);
- break;
- case R.id.googlemaptest_button:
- Intent mi = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=Tokyo"));
- startActivity(mi);
- break;
- case R.id.dialtest_button:
- Intent di = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:123456789"));
- startActivity(di);
- break;
- case R.id.contacttest_button:
- Intent cti = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/1"));
- startActivity(cti);
- break;
- case R.id.close_button:
- finish();
- }
- }
- }
コンタクトリストを登録しておく

0 件のコメント:
コメントを投稿