2012-10-23 3 views
0

내 앱에서 JSON의 텍스트 콘텐츠를 받고 있는데 텍스트보기로 표시하고있는 콘텐츠입니다. 그러나 문제는 텍스트가 완전하게 나타나지 않고 형식도 지정되어 있지 않다는 것입니다. http://jsonformatter.curiousconcept.com/을 사용하여 JSON을 검사했고 JSON이 유효 함을 보여주었습니다. 로그에서받은 내용이 인쇄되어 완료되었습니다. 심지어 textview로 설정하고 다시 그것을 얻은 후에도 완전한 데이터를 얻고 있습니다. 그러나 완전한 텍스트를 표시하지는 않습니다. 어디에 문제가Android : JSON에서 가져온 데이터가 텍스트보기에 표시되지 않습니다.

This is how it appears in the app:

것은 내가지고 있지 않다. 텍스트 뷰는 스크롤 뷰 내부에 있습니다. 기본 활동 BaseActivity에 대한

public class TIEBaseActivity extends MapActivity 
{ 
//private ProgressDialog dialog; 
public AlertDialog _alertDialog; 
protected HeaderBar _headerBar; 
protected FooterBar _footerBar; 
protected LinearLayout _manager; 
protected LinearLayout form; 
protected TIEBaseActivity _self; 

public void createDefaultView(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.basescreen); 
    this._self=this; 
    initView(); 
} 

public void loadFormFromResource(int resourceID) 
{ 
    LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    View view = inflater.inflate(resourceID, null); 
    _manager.addView(view); 

} 

public void loadDefaultForm() 
{ 
    form=new LinearLayout(this); 
    form.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); 
    form.setOrientation(LinearLayout.VERTICAL); 
    form.setGravity(Gravity.CENTER); 
    _manager.addView(form); 
} 

public void initView() 
{ 

    _headerBar = (HeaderBar) findViewById(R.id.baseHeaderBar); 
    _manager = (LinearLayout) findViewById(R.id.baseScrollContent); 
    //_footerBar = (FooterBar) findViewById(R.id.baseFooterBar); 

    _headerBar.view.setVisibility(View.GONE); 
    //_footerBar.view.setVisibility(View.GONE); 
} 

protected void showScreen(Intent intent) { 
    startActivity(intent); 
} 

public void setHeaderTitle(String title) { 

    if (_headerBar!=null) { 
     _headerBar.setTitle(title); 
    } 

} 

public Handler progressCloseHandler = new Handler() { 
    public void handleMessage(Message msg) { 
     super.handleMessage(msg); 
     if (_alertDialog != null) 
      _alertDialog.cancel(); 
    } 

}; 

private Handler alertViewHandler = new Handler() { 

    public void handleMessage(Message msg) { 
     String message=(String)msg.obj; 
     AlertDialog.Builder _alert = new AlertDialog.Builder(TIEBaseActivity.this); 
     _alert.setMessage(message) 
     .setCancelable(false) 
     .setPositiveButton("OK", new DialogInterface.OnClickListener() { 
      public void onClick(DialogInterface arg0, int arg1) { 
      } 
     }); 
     _alert.create().show(); 
    } 
}; 

public void DisplayAlert(String message) { 

    Message msg=Message.obtain(alertViewHandler); 
    msg.obj=message; 
    alertViewHandler.sendMessage(msg); 

} 

public void DisplayAlert(String message, int id) { 

    Message msg=Message.obtain(alertViewHandler); 
    msg.obj=message; 
    msg.what=id; 
    alertViewHandler.sendMessage(msg); 
} 


private Handler closeViewHandler=new Handler() { 
    public void handleMessage(Message msg) { 
     super.handleMessage(msg); 
     _self.finish(); 
    } 
}; 

public void closeScreen() { 

    closeViewHandler.sendMessage(Message.obtain(closeViewHandler)); 

} 

public void openRating() 
{ 
    Intent marketIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=com.dzo.tie")); 
    startActivity(marketIntent);  
} 

@Override 
public void onConfigurationChanged(Configuration newConfig) { 

    super.onConfigurationChanged(newConfig); 
} 

public void openShare() 
{ 

    String mMailSubject = "OIE App. - Get the All Indian Events happening in Overseas"; 
    String mMailMessage = null;  
    mMailMessage = "Hi,\n I found this great Application. This application customize for Overseas Indian Events."; 
    mMailMessage += "\n"; 
    mMailMessage += "Go to: https://market.android.com/details?id=com.dzo.oie"; 
    mMailMessage += ",\n Please visit: http://www.dotzoo.net to see more about Dotzoo Inc."; 

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
    emailIntent.setType("text/*");    
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, ""+mMailSubject); 
    emailIntent.putExtra(Intent.EXTRA_TEXT, mMailMessage); 
    startActivity(Intent.createChooser(emailIntent, "Share via...")); 

} 

@Override 
protected boolean isRouteDisplayed() { 
    // TODO Auto-generated method stub 
    return false; 
} 

} 

레이아웃 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:background="@color/white" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:id="@+id/baseLayout"> 

<com.dzo.tie.ui.HeaderBar 
    android:id="@+id/baseHeaderBar" 
    android:layout_width="fill_parent" 
    android:layout_height="50dp"/> 

<ScrollView 
    android:scrollbars="vertical" 
    android:fillViewport="true" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <LinearLayout 
     android:id="@+id/baseScrollContent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:gravity="center" 
     android:layout_gravity="center" 
     android:layout_width="fill_parent"> 

    </LinearLayout> 
</ScrollView> 

내가 내 활동 수업이 기본 활동을 확장하고있다 :

다음

내 코드입니다

내 활동 당신은 텍스트의 나머지 부분을보기 위해 스크롤해야

<?xml version="1.0" encoding="utf-8"?> 
<TextView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:id="@+id/txtTieInfo" 
android:textSize="12sp" 
android:textColor="@color/copper_gold" 
android:lineSpacingExtra="5dp"/> 
+0

여기에 코드를 게시하십시오. 그러면 문제가 될 수 있습니다. –

+0

내 업데이트 – Nitish

답변

1

에 대한 나의 활동

public class TIEInfo extends TIEBaseActivity 
{ 
TextView txtTieInfo; 
String contents; 

private String infoUrl = "http://www.tradeineu.com/tie_app/aboutTie.php"; 
protected void onCreate(Bundle savedInstanceState) 
{ 
    super.createDefaultView(savedInstanceState); 
    _headerBar.view.setVisibility(View.VISIBLE); 
    super.setHeaderTitle("Info"); 
    init(); 
    new TIEInfoAsyncTask(getParent(), infoUrl, txtTieInfo).execute(); 
}//onCreate 

public void init() 
{ 
    loadFormFromResource(R.layout.tieinfo); 
    txtTieInfo = (TextView)findViewById(R.id.txtTieInfo); 
}//init 
}//TIEInfo 

레이아웃. scrollview 안에 텍스트 뷰를 배치하면 괜찮습니다.

+0

을 (를) 이미 스크롤보기 내부에 표시하십시오. – Nitish

+0

문제는 위에 게시 한 스크린 샷의 처음 두 줄을 본다면 가운데 부분에서 텍스트가 표시되고 원본 내용은 해당 문장 위에 두 개의 단락이 더 있고 왜 그런지 이유가없는 것입니다. 완성 된 컨텐츠가 텍스트 뷰로 설정되면 중간에서 컨텐츠를 보여줍니다. – Nitish

+0

관련 소스 코드를 게시 해주십시오. 질문에 추가하십시오. –

관련 문제