Android Can';是否显示所有description.StringBuffer容量?
我想在我的应用程序上阅读RSS提要,我已经基于一些指南,并且我成功地实现了基础。但是,当我打开一个RSS项目时,标题会显示出来,但是描述(包含更多字符)以大约13行和三个点(…)结尾。我在JAVA文档中读到StringBuffer的容量有限,当它达到最大容量时,它会设置一个点。这就是为什么我认为问题来自StringBuffer:Android Can';是否显示所有description.StringBuffer容量?,android,textview,stringbuffer,Android,Textview,Stringbuffer,我想在我的应用程序上阅读RSS提要,我已经基于一些指南,并且我成功地实现了基础。但是,当我打开一个RSS项目时,标题会显示出来,但是描述(包含更多字符)以大约13行和三个点(…)结尾。我在JAVA文档中读到StringBuffer的容量有限,当它达到最大容量时,它会设置一个点。这就是为什么我认为问题来自StringBuffer: public void startElement(String uri, String localName, String name, Attributes a
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
// Nous réinitialisons le buffer a chaque fois qu'il rencontre un item
buffer = new StringBuffer();
// Ci dessous, localName contient le nom du tag rencontré
// Nous avons rencontré un tag ITEM, il faut donc instancier un nouveau feed
if (localName.equalsIgnoreCase(ITEM)){
this.currentFeed = new Feed();
inItem = true;
}
// Vous pouvez définir des actions à effectuer pour chaque item rencontré
if (localName.equalsIgnoreCase(TITLE)){
// Nothing to do
}
if (localName.equalsIgnoreCase(LINK)){
// Nothing to do
}
if (localName.equalsIgnoreCase(PUBDATE)){
// Nothing to do
}
if (localName.equalsIgnoreCase(CREATOR)){
// Nothing to do
}
if(localName.equalsIgnoreCase(DESCRIPTION)){
}
}
@Override
public void endElement(String uri, String localName, String name) throws SAXException {
if (localName.equalsIgnoreCase(TITLE)){
if(inItem){
// Les caractères sont dans l'objet buffer
this.currentFeed.setTitle(buffer.toString());
buffer = null;
}
}
if (localName.equalsIgnoreCase(LINK)){
if(inItem){
this.currentFeed.setLink(buffer.toString());
buffer = null;
}
}
if (localName.equalsIgnoreCase(PUBDATE)){
if(inItem){
this.currentFeed.setPubDate(buffer.toString());
buffer = null;
}
}
if (localName.equalsIgnoreCase(CREATOR)){
if(inItem){
this.currentFeed.setCreator(buffer.toString());
buffer = null;
}
}
if(localName.equalsIgnoreCase(DESCRIPTION)){
if(inItem){
this.currentFeed.setDescription(buffer.toString());
buffer = null;
}
}
if (localName.equalsIgnoreCase(ITEM)){
feeds.add(currentFeed);
inItem = false;
}
}
// * Tout ce qui est dans l'arborescence mais n'est pas partie
// * intégrante d'un tag, déclenche la levée de cet événement.
// * En général, cet événement est donc levé tout simplement
// * par la présence de texte entre la balise d'ouverture et
// * la balise de fermeture
public void characters(char[] ch,int start, int length) throws SAXException{
String lecture = new String(ch,start,length);
if(buffer != null) buffer.append(lecture);
}
// cette méthode nous permettra de récupérer les données
public ArrayList<Feed> getData(){
return feeds;
}
}
public void startElement(字符串uri、字符串localName、字符串名称、属性)引发SAX异常{
//我们需要在合同项下的缓冲区上写上姓名首字母
buffer=新的StringBuffer();
//Ci dessous,localName contient le nom du tag rencontré
//Nous avons Rencontractéun tag ITEM,il faut donc Instancer un nouveau feed
if(localName.equalsIgnoreCase(ITEM)){
this.currentFeed=新Feed();
inItem=true;
}
//您是否已经完成了合同项下的有效行动
if(localName.equalsIgnoreCase(TITLE)){
//无事可做
}
if(localName.equalsIgnoreCase(链接)){
//无事可做
}
if(localName.equalsIgnoreCase(PUBDATE)){
//无事可做
}
if(localName.equalsIgnoreCase(创建者)){
//无事可做
}
if(localName.equalsIgnoreCase(说明)){
}
}
@凌驾
public void endElement(字符串uri、字符串localName、字符串名称)引发SAXException{
if(localName.equalsIgnoreCase(TITLE)){
if(inItem){
//这是一个很好的缓冲区
this.currentFeed.setTitle(buffer.toString());
缓冲区=空;
}
}
if(localName.equalsIgnoreCase(链接)){
if(inItem){
this.currentFeed.setLink(buffer.toString());
缓冲区=空;
}
}
if(localName.equalsIgnoreCase(PUBDATE)){
if(inItem){
this.currentFeed.setPubDate(buffer.toString());
缓冲区=空;
}
}
if(localName.equalsIgnoreCase(创建者)){
if(inItem){
this.currentFeed.setCreator(buffer.toString());
缓冲区=空;
}
}
if(localName.equalsIgnoreCase(说明)){
if(inItem){
this.currentFeed.setDescription(buffer.toString());
缓冲区=空;
}
}
if(localName.equalsIgnoreCase(ITEM)){
feed.add(currentFeed);
inItem=false;
}
}
//*兜售这一地区的树木
//*国际商标,请在证书上签字。
//*从总体上看,这是一种简化
//* Pa La Pr.P.E.
//*费米酒店
公共无效字符(char[]ch,int start,int length)引发SAXException{
字符串讲座=新字符串(ch、开始、长度);
if(buffer!=null)buffer.append(讲座);
}
//这是一个很好的方法
公共ArrayList getData(){
回馈;
}
}
需要帮忙吗?多谢各位
<?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:text="" android:id="@+id/tv_title" android:layout_gravity="center_horizontal" android:layout_height="50dp" android:layout_width="fill_parent"/>
<TextView android:text="" android:id="@+id/tv_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp"/>
<TextView android:text="" android:id="@+id/tv_date" android:layout_marginTop="30dp" android:layout_height="fill_parent" android:layout_width="fill_parent"/>
</LinearLayout>
否,StringBuffer
没有此类行为。您可能正在使用TextView
并设置属性,或者您的提要数据实际上被截断并省略。直接在浏览器中查看RSS提要,看看它是否正确 请看发布的XML,我认为它没有什么“奇怪”的地方,不是吗?它本身被截断并省略了:\?(我在浏览器中看到了RSS提要,在我的应用程序中它遗漏了很多字符)你能将URL发布到你的RSS提要吗?@kabuko:这在源代码处明显被省略了。显然,Chrome做了一些特殊的事情来获取全文,这可能是您看到的,并且您认为它没有被截断,但是如果您查看查看来源:feeds.feedburner.com/Frandroid,您可以看到它是。奇怪:\您知道如何解决这个问题吗?只需在浏览器中启动rss项目?您可以获得
标记中提供的原始链接并将其下拉,但您必须处理HTML。