2013-08-25 3 views
0

이것은 내 코드입니다.이 코드를 AsyncTask onPostExcute 함수에서 실행합니다.TextView setText raise 응용 프로그램 일시 중지

LayoutInflater inflater =LayoutInflater.from(this.context); 
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.custom_info_window, null, false); 
    layout.addView(layout); 
    View view = (View) layout; 

    ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge); 
    String title = marker.getTitle(); 
    TextView titleUi = ((TextView) view.findViewById(R.id.title)); 
    titleUi.setText(title); 

여기에 응용 프로그램 실행, 오류없이 여기

응답은 나의 xml 파일은 내가 아니라이보기를 DISPALY하려고 내용

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="horizontal" > 

<ImageView 
    android:id="@+id/badge" 
    android:contentDescription="@string/info_window" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginRight="5dp" 
    android:adjustViewBounds="true" > 
</ImageView> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:ellipsize="end" 
     android:singleLine="true" 
     android:textColor="#ff000000" 
     android:textSize="14sp" 
     android:textStyle="bold" /> 
    <TextView 
     android:id="@+id/snippet" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ellipsize="end" 
     android:singleLine="true" 
     android:textColor="#ff7f7f7f" 
     android:textSize="14sp" /> 
</LinearLayout> 
custom_info_window.xml라는 이름의 경우 AsyncTask 이후 Mainactivity의 하위 뷰는 을 실행했지만 작동하지 않았습니다. 오류나 경고가 없습니다. "titleUi.setText ("1312 ")"줄에 중단 점을 설정합니다. 응용 프로그램이 여기서 실행될 때 응답이 없습니다. 죽은 것처럼 보입니다.

누구든지 나를 도와 줄 수 있습니까? 감사합니다.

답변

1

봅니다 여기에 전체 AsyncTask를 코드를 게시 할 수 있습니다. 나는 잘못이 코드의 아래 부분에 생각 :

LayoutInflater inflater =LayoutInflater.from(this.context); 
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.custom_info_window, null, false); 
layout.addView(layout); 
View view = (View) layout; 

대신이 시도

LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); 
View view = inflater.inflate(R.layout.custom_info_window, null); 
    ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge); 
    String title = marker.getTitle(); 
    TextView titleUi = ((TextView) view.findViewById(R.id.title)); 
    titleUi.setText(title); 
+0

하십시오 투표 업하고 문제를 해결하는 경우 모든 사용자가를 알 수 있도록, 내 대답을 받아 문제가 해결되었습니다. 도와 줄 수있어서 기뻐! –

0

DEBUGGER (디버거)로 이동하여 진행 상황을 자세히 파악합니다.

또는 사용 :

Log.e("Log Title","message"); 
관련 문제