android - Chaining activities inside a tab -
Here's my problem: a list of albums in each tab is an application with me to tab to a different list Is listed, then on one screen with an image, clickable text etc. In one word, I have work inside the tab.
Despite looking a long time between the question forum and tutorials can not just witch figure out the best way to do this: switching activity is a tab change insde or scene.
here saved my code
public class application enhances Tabaktiviti Crete (bundle {public void Instansstet) {Suprknkret (saved Instensstet); SetContentView (R.layout.main); Resource res = getResources (); // Resources to get the Drawables TabHost tab object = getTabHost (); // Activity TabHost TabHost.TabSpec Tip; // intent to re-usable TabSpec intentions for each tab; // Re-usable intent for every tab // Create an intent to launch an activity for tabs (can be reused) Intents = New Intent () SetClass (this, Activity0.class); // Start a TabSpec for each tab and add it to TabHost spec = tabHost.newTabSpec ("0"). SetIndicator ("0", res.getDrawable (R.drawable.ic_tab_0)) .setContent; TabHost.addTab (idea); Intent = new intent (). SetClass (this, activity 1. class); Spec = tabHost.newTabSpec ( "1") setIndicator ( "1", res.getDrawable (R.drawable.ic_tab_1)) .setContent (intent); TabHost.addTab (idea);
Then I will have to change the activities (activity 0 -> Activity 01) inside tab 0
increases the public category Activity0 activity {.. public void OnCreate (Bundle Saved InstantState) {Super.onCreate (Saved Instantstate); SetContentView (R.layout.mainlist); ListView l1 = (ListView) findViewById (R.id.ListView01); l1.setOnItemClickListener (New OnItemClickListener () {public void onItemClick (AdapterView & LT ;? & gt; arg0, see ARG1, ARG2 integer, long arg3) {// Toast.makeText (getBaseContext (), "you clciked" + parentTypes. get (ARG2) .getLibelle (), toast.LENGTH_LONG). show (); / * TODO database method * / type Orientation parents = parentTypes.get (arg2); if (parent.getChildren (). size ()! = 0) {intent i = new intent (typewritten, this class, type class); int id = new long (parenttepes.gate (ag2) .goid ()) .intvu (); i. Epititra ("typed", id ); Give view Um =
then return to this activity from activity activity
Ex>
increases the activity of the public class Activity01 {tv.setOnClickListener (click on New View.OnClickListener () {Public Zero (see View) {Intent I = New Intent (TypeChildList. This, Activity0.class); Local Activity Manager Compliance; View2 = lam.start Activity ("Activity 0", i) .getDecorView () View; SetContentView (view2); }});
After I get an error, java.lang.IllegalStateException The specified child already has a parent. You must call the removeView () on the parent of the child first.
I know that it comes from my thoughts but I do not understand how to fix this so it is the best practice to do more than one activity in a tab << P>
If you put ViewSwitcher
or ViewFlipper
Switch to your heart's desire to connect and back to that view.
Comments
Post a Comment