安卓html可以删除吗,如何删除android中的html标签
Jitendra Patidar
1
java
android
json
我在我的android應(yīng)用程序中使用json,實際上在列表視圖中我的文本中也顯示了html標(biāo)簽,我怎樣才能顯示避免html標(biāo)簽的文本
Mainactivity.java
public class MainActivity extends ListActivity implements FetchDataListener
{
private ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_list_item);
initView();
}
private void initView()
{
// show progress dialog
dialog = ProgressDialog.show(this, "", "Loading...");
String url = "http://floating-wildwood-1154.herokuapp.com/posts.json";
FetchDataTask task = new FetchDataTask(this);
task.execute(url);
}
@Override
public void onFetchComplete(List data)
{
// dismiss the progress dialog
if ( dialog != null )
dialog.dismiss();
// create new adapter
ApplicationAdapter adapter = new ApplicationAdapter(this, data);
// set the adapter to list
setListAdapter(adapter);
}
@Override
public void onFetchFailure(String msg)
{
// dismiss the progress dialog
if ( dialog != null )
dialog.dismiss();
// show failure message
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
}
}
Applicationadapter.java
public class ApplicationAdapter extends ArrayAdapter
{
private List items;
public ApplicationAdapter(Context context, List items)
{
super(context, R.layout.app_custom_list, items);
this.items = items;
}
@Override
public int getCount()
{
return items.size();
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;
if ( v == null )
{
LayoutInflater li = LayoutInflater.from(getContext());
v = li.inflate(R.layout.app_custom_list, null);
}
Application app = items.get(position);
if ( app != null )
{
TextView titleText = (TextView) v.findViewById(R.id.titleTxt);
if ( titleText != null )
titleText.setText(app.getContent());
}
return v;
}
}
在我的listview中它顯示如下
你好
frnds '
'
gudmrng'
'
它用html標(biāo)簽顯示,我只想要文本數(shù)據(jù),文本必須顯示在我的listview中.
總結(jié)
以上是生活随笔為你收集整理的安卓html可以删除吗,如何删除android中的html标签的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手写html基础格式,手写服务器_HTM
- 下一篇: 前前前世用计算机,前前前世