需要Activity
顯示AlertDialog
,因爲我們可以't display Dialog
from Service
解決方案。
創建Activity
作爲對話框主題,並從Service
開始Activity
。
只需要Activity
註冊你menifest.xml
類似如下
android:theme="@android:style/Theme.Dialog"
或
android:theme="@android:style/Theme.Translucent.NoTitleBar"
MyDialog.java
public class MyDialog extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("your title");
alertDialog.setMessage("your message");
alertDialog.setIcon(R.drawable.icon);
alertDialog.show();
}
}
訪問https://code.google.com/p/android-smspopup/ –
也訪問https:// github。com/selmantayyar/Custom-SMS-Popup –
感謝您的聯繫。 –