i am implementing android tabed view with list view as shown in this tutorial,
http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
suppose my tabs are like this vieweditems and unvieweditems, where i am loading files as listitems. so when i click on vieweditems and selected an entry from the listview, i can view the items, then i press back i will again get the tabview. but here the file which i viewed again is also present there.
And i am loading the files from the sdcard which is in a specified folder.
look at mycode
public class MainPageEBook extends TabActivity {
// TabSpec Names
private static final String Unviewed_SPEC = "Unviewed";
private static final String Viewed_SPEC = "viewed";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_tab);
System.out.println("hesredsjncs");
TabHost tabHost = getTabHost();
// unviewed Tab
TabSpec inboxSpec = tabHost.newTabSpec(Unviewed_SPEC);
// Tab Icon
inboxSpec.setIndicator(Encrypted_SPEC);
Intent inboxIntent = new Intent(this, UnviewedFiles.class);
// Tab Content
inboxSpec.setContent(inboxIntent);// loads the viewed files when pressed back
// startActivity(inboxIntent);// if i give this i wont get tabed view
// viewed Tab
TabSpec outboxSpec = tabHost.newTabSpec(Viewed_SPEC);
outboxSpec.setIndicator(Viewed_SPEC);
Intent outboxIntent = new Intent(this, ViewedFiles.class);
outboxSpec.setContent(outboxIntent);
//startActivity(outboxIntent);
// Profile Tab
// Adding all TabSpec to TabHost
tabHost.addTab(inboxSpec); // Adding Inbox tab
tabHost.addTab(outboxSpec); // Adding Outbox tab
}
}
i have a filter function so that in the activity UnviewedFiles, the files which are already viewed wont be shown.
my logic is like this all the files will be in a folder say unviewed, when i click on a file it will be copied to viewed folder.
in my filter function i am taking the names of all files in both folders to string arrays viewedstring[] and unviewedstring[]. i compare both of them a create a new array with strings which are present in unviewdstring[] but abscent in viewedstring[]. this function is writted UnviewedFiles.java.
so when i call
inboxSpec.setContent(inboxIntent);
only the previous view is loaded, i want the updated list view. how to do it?
please help