이것은 내 대화 상자 자바 파일로 문제를 일으키고 있습니다. 그것은 매우 잘 작동하는 다른 대화 파일입니다. 이 대화 상자는 다른 진행 대화 상자가 끝날 때 호출됩니다. 다른 하나는 닫히지 만이 새 코드는 열리지 않습니다 (그러나 코드는 실행됩니다). 이유는 모르겠습니다.대화 상자가 Android에 표시되지 않습니다. 이유가 무엇인가요?
public class Response extends Dialog implements OnClickListener {
Button cpandclose;
EditText response;
Context context;
//Skapar dialog med About xml filen
public Response(Context context, String url) {
super(context);
/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
requestWindowFeature(Window.FEATURE_NO_TITLE);
/** Design the dialog in main.xml file */
setContentView(R.layout.response);
cpandclose = (Button) findViewById(R.id.cpandclose);
cpandclose.setOnClickListener(this);
response = (EditText) findViewById(R.id.resposeurl);
response.setText("http://xxx.com/i/" + url);
this.context = context;
Log.d("Response Window: ", "running..");
}
public void onClick(View v) {
if (v == cpandclose) {
ClipboardManager ClipMan = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipMan.setText(response.getText());
dismiss();
}
}
}
표시되지 않습니다 대화의 xml-file
:
<?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" >
<TextView
android:id="@+id/responsetxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Response:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/resposeurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<requestFocus />
</EditText>
<Button
android:id="@+id/cpandclose"
android:layout_width="225dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Copy and Close" />
</LinearLayout>
백그라운드에서 일부 데이터를 업로드하고 언제 마무리는 데이터를 문자열로 반환 적용하여 App 기능 :
를camera.responseFromServer(serverResponse);
현재 카메라 객체와 해당 함수에서 responseFromServer 메소드를 호출하는 것은 다음과 같습니다 :
public void responseFromServer(String url) {
Looper.prepare();
Response response = new Response(this, url);
Log.d("response: ", url);
response.show();
}
이것은 프로그램을 실행하지만 표시되는 대화 상자를 볼 수 없습니다. 어떻게 그렇게 될수 있니? 그것은 쉬운 해결책일지도 모르지만 모든 것을 시도한 것처럼 느껴집니다!
귀하의 조언과 더 나은 지혜를 주셔서 감사합니다.
감사합니다. :) – Ms01
호기심에서 왜이 대답을 받아 들일 수 없었습니까? 친애하는. – pouzzler
작동하지 않았기 때문입니다. 나는 android dev 사이트의 지침을 따랐다. 서버에서 데이터를 받았을 때 대화 상자가 표시되지 않는다. 조사하고 싶으면 집에있을 때 더 자세한 정보를 게시 할 수 있습니다. :) – Ms01