1
다음 코드를 실행하면 "불행하게도 다이얼러가 작동을 멈췄다"는 것을 알 수 있습니다."안타깝게도 전화 걸기가 중단되었습니다"라는 메시지가 나타나는 이유는 무엇입니까?
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hell">sanjoy</string>
<string name="app_name">Test</string>
<string name="button">ShowDialer</string>
</resources>
왜이 될 것
DialerActivity.java
package com.test;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.net.Uri;
import android.widget.Button;
import android.view.*;
public class DialerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button callButton=(Button) findViewById(R.id.callButton);
callButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
try {
Intent CallIntent =
new Intent(Intent.ACTION_CALL,Uri.parse("tel:9563460376"));
CallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(CallIntent);
}
catch(Exception e)
{
}
}
});
}
}
main.xml에
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<button android:id="@+id/callButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="ShowDialer"
android:background="#d3d3d3">
</button>
</LinearLayout>
string.xml : 여기
내 코드의 조각이다 사고?
앱에 통화 권한을 추가 했습니까? plz 포럼에 질문을 게시하기 전에 [일부 조사] (https://www.google.com.pk/search?q=android+unfortunatly+application+has+stopped)를 수행하십시오. :) –
예 내가 –
버튼 자본 <버튼 안드로이드 것이다 호출 권한 CALL_PHON 추가 : ID = "@ + ID/callButton" 안드로이드 : layout_width = "fill_parent" 안드로이드 : layout_height = "wrap_content" 안드로이드 : 텍스트 = " ShowDialer " android : background ="# d3d3d3 "> 여기에 코드 입력 –