제 지식으로는 서비스에서 대화 상자를 열 수 없습니다. 하지만 그 서비스에 대한 팝업 창을 열 수있는 옵션이 하나 있습니다.
1) 팝업 창의 레이아웃을 만듭니다.
2) 활동을 만들고 서비스에서)이
<activity android:theme="@android:style/Theme.Dialog">
4를 작성해야 매니페스트에서이 활동
3) 콘텐츠보기로 레이아웃 설정 당신이 때 당신이 활동을 호출해야 열 popup.But 서비스에서 당신이
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
으로 의도의 플래그를 설정해야한다는 것이 마음을 유지하려면 이제 팝업 창으로 활동을 열 수 있습니다.
EDIT
1) 레이아웃 main.xml에
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText android:id="@+id/web"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
2) 팝업로서 작용할 것이다 test2.java는
package com.example.AutocompleteTextView;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Test2 extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
3) 파일 Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.AutocompleteTextView" android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".CustomAutoComplete" android:label="@string/app_name">
</activity>
<activity android:name="test1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Test2" android:theme="@android:style/Theme.Dialog">
</activity>
<service android:name="MyService"></service>
</application>
</manifest>
4) 서비스 MyService.java
package com.example.AutocompleteTextView;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.IBinder;
public class MyService extends Service{
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
Intent intent1 = new Intent(this, Test2.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent1);
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
}
이있는 내가
package com.example.AutocompleteTextView;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.FrameLayout;
public class test1 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startService(new Intent(getApplicationContext(), MyService.class));
finish();
}
}
여기에 당신이 indentify..when 메시지가 필요합니다. 그래서 그 방송 수신기 클래스를 사용하여 할 수 있습니다 .. 그래서 당신이 사용자 정의 대화 팝업 팝업있어. 사용자 정의 대화 상자에 대한 링크 : http : //www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application – CoDe
SDK의 ApiDemos 프로젝트 - DialogActivity 샘플을 살펴보십시오. –