Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My suggestion would be to use a broadcast. I think that the timing would require a sticky broadcast. Maybe something like this:</p> <pre><code>public MyTabActivity taba = new MyTabActivity(); protected void onListItemClick (ListView l, View v, int position, long id){ super.onListItemClick(l, v, position, id); mystring = listofHashMap.get(position).get("keyname").toString(); // create the intent to send and give it the data Intent i = new Intent("updateTextView"); i.putExtra("textFromList", mystring); sendStickyBroadcast(i); int i=1;//the tab where I want to go, and MyActivity is its content taba.ChangeTab(i); } </code></pre> <p>And then in MyActivity, write something like this:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // your onCreate method registerReceiver(updateTextReceiver, new IntentFilter("updateTextView")); } protected void onDestroy() { super.onDestroy(); // your onDestroy method unregisterReceiver(updateTextReceiver); } private BroadcastReceiver updateTextReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { tv = (TextView)findViewById(R.id.tvid); String myString = intent.getStringExtra("textFromList"); if (myString != null) { tv.setText(myString); } } }; </code></pre> <p>For the sticky broadcast, there's an additional permission needed in the manifest. I'm not sure but maybe you could just send a regular broadcast if you swapped the order of sending the broadcast and changing the tab.</p>
    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.
 

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