Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid- Calling Specific Method from ListAcitivity which invokes method in 1 of the TabActivity w/o losing TabHost
    primarykey
    data
    text
    <h2>Calling Specific Method from ListActivity which invokes method in one of the Parent(TabActivity) w/o Losing TabHost Layout</h2> <p>I have Two Activity Inside TabHost 1.PlayingActivity 2.AlbumActivity</p> <p>By Clicking Button inside AlbumActivty will jump to LIstActivity ->By clicking Item in ListActivity, I want to jump back to one of the method inside-PlayingActivity w/o Losing Tab Layout.</p> <p>I can accomplish task by calling Activity n specific Method using these</p> <h1>ListActivity clicking on Item invokes specific Method in PlayingActivity</h1> <pre><code>Class SongList extends ListActivty { public void onCreate(Bundle savedInstanceState) { //implemented list adapter-ls listadapter. . . . ls.setOnItemClickListener(New View.onItemClickListener) { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { int songIndex=position; Intent i=new Intent(getApplicationContext(),AlbumActivity.class); i.putExtra("methodName", "myMethod"); i.putExtra("index", songIndex); startActivity(i); } } } } </code></pre> <h1>MainActivity which host PlayingActivity &amp; AblumActivity Under TabHost</h1> <pre><code>public class MainActivity extends TabActivity { private static final String NOW_PLAYING = "Playing"; private static final String ALBUM = "Album"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost tabHost = getTabHost(); // Playing Tab TabSpec PlayingSpec = tabHost.newTabSpec(NOW_PLAYING); // Tab Icon PlayingSpec.setIndicator(NOW_PLAYING, getResources().getDrawable(R.drawable.icon_now_playing)); Intent PlayingIntent = new Intent(this, PlayingActivity.class); // Tab Content PlayingSpec.setContent(PlayingIntent); // Album Tab TabSpec AlbumSpec = tabHost.newTabSpec(ALBUM); AlbumSpec.setIndicator(ALBUM, getResources().getDrawable(R.drawable.icon_music)); Intent AlbumIntent = new Intent(this, AlbumActivity.class); AlbumSpec.setContent(AlbumIntent); // Adding all TabSpec to TabHost tabHost.addTab(PlayingSpec); // Adding Playing tab tabHost.addTab(AlbumSpec); // Adding Album tab } </code></pre> <p>}</p> <h1>In PlayingActivity called specific method(playSong())</h1> <pre><code>class PlayingActivity extends Activity { public void onCreate(Bundle savedInstanceState) { } protected void onNewIntent(Intent intent) { super.onNewIntent(intent); String index=intent.getStringExtra("index"); if(intent.getStringExtra("methodName").equals("myMethod")){ playSong(Integer.parseInt(index)); } } private void playSong(int i) { } } </code></pre> <h1>Now the Catch iz I can somehow invokes specific Method in PlayingActivity but Playing Activity which is under TabHost loses it's TabLayout</h1> <h1>Is there AnyWay we can save Playing Activity to lose from it's TabLayout??</h1>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload