Hello guys i am doing an application to show rss feed according to interest . i want to use checkboxes to hide and show rss feeds : This is my page for showing the rss feed . I have the following classes (Downloader , RSSParser , Connector , ErrorTracker). I want to show and hide on checkboxes . Kindly help me use this code to hide the rss i want to hide using checkbox from another class
public class Businesstimesrss extends AppCompatActivity {
final static String urlAddress2 = "http://wap.business-standard.com/rss/latest.rss";
final static NewFeedOriginator add1 = new NewFeedOriginator("Business Standard","http://wap.business-standard.com/rss/latest.rss");
final static NewFeedOriginator add2 = new NewFeedOriginator("Business Times","http://www.businesstimes.com.sg/rss/top-stories");
final static NewFeedOriginator add3 = new NewFeedOriginator("Fox Sports","https://api.foxsports.com/v1/rss?partnerKey=zBaFxRyGKCfxBagJG9b8pqLyndmvo7UU&tag=nfl");
ArrayList<Article> articles = new ArrayList<>();
boolean started =false;
boolean bdfinished = false;
boolean cdfinished = false;
boolean edfinished = false;
Downloader bd ,cd , ed;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_businesstimesrss);
final ListView lv = (ListView) findViewById(R.id.lv);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!started){
bd = new Downloader(Businesstimesrss.this,add1,lv);
bd.execute();
cd = new Downloader(Businesstimesrss.this,add2,lv);
cd.execute();
ed = new Downloader(Businesstimesrss.this,add3,lv);
ed.execute();
started = true;
return;
}
if(bd.getStatus() == Downloader.Status.FINISHED && !bdfinished){
articles.addAll(bd.getDownloadedArticles());
bdfinished = true;
}
if(cd.getStatus() == Downloader.Status.FINISHED && !cdfinished){
articles.addAll(cd.getDownloadedArticles());
cdfinished = true;
}
if(ed.getStatus() == Downloader.Status.FINISHED && !edfinished){
articles.addAll(ed.getDownloadedArticles());
edfinished = true;
}
if(bdfinished && cdfinished && edfinished )
lv.setAdapter(new CustomAdapter(Businesstimesrss.this , articles));
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.homepage, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == android.R.id.home) {
startActivity(new Intent(Businesstimesrss.this,Businesslink.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
Aucun commentaire:
Enregistrer un commentaire