do it 책보고 하고있는데
2일째입니다.
학원 컴퓨터가 안좋아서 가상 머신이 잘안돌아가는데요
그래서 그냥 스마트폰 물려서 할려고하는데 간단한 소스에서도 오류가 나네요
왜인지는 모르겠씁니다 책에 있는 그대로 했는데
버튼눌러서 웹페이지 띄우는건 되는데
전화기능이랑 새로운 액티비티 여는건 안되네요
구동 프로그램은 안드로이드 스튜디오입니다.
package org.androidtown.test1;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButton1Clicked(View v) {
// Toast.makeText(getApplicationContext(), "버튼이 눌렸어요", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://m.gooogle.com"));
startActivity(intent);//버튼으로 웹페이지 띄우기
}
void onButton2Clicked(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:010-7104-9218"));
startActivity(intent);//전화걸기 띄우기
}
void onButton3Clicked(View v) {
Intent intent = new Intent(getApplicationContext(), NewActivity.class);
startActivity(intent);//새로운창 띄우기
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}