I have a similar issue. Is this an Android bug?
On 9 jul, 12:35, extrapedestrian <[email protected]> wrote:
> its me again, here is simple example to reproduce this bug, please if
> anyone can confirm it, (or point out mistake i make) i would
> appreciate it...
>
> public class TabHostListView extends TabActivity implements
> TabHost.TabContentFactory {
> /** Called when the activity is first created. */
>
> private String mListOfResults[] = {"item1", "item2", "item3"};
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> TabHost.TabSpec spec=getTabHost().newTabSpec("First");
> spec.setContent(this);
> spec.setIndicator("First");
> getTabHost().addTab(spec);
>
> spec=getTabHost().newTabSpec("Second");
> spec.setContent(this);
> spec.setIndicator("Second");
> getTabHost().addTab(spec);
> }
>
> @Override
> public View createTabContent(String arg0) {
> // create list here
> LayoutInflater inflater = LayoutInflater.from(getBaseContext
> ());
> ListView mLV = (ListView)inflater.inflate
> (R.layout.list_layout, null);
> mLV.setAdapter(new ArrayAdapter<String>
> (this,android.R.layout.simple_list_item_1,mListOfResults));
> registerForContextMenu(mLV);
> return mLV;
> }
>
> @Override
> public void onCreateContextMenu(ContextMenu menu, View v,
> ContextMenuInfo menuInfo) {
> // Display sms action
> super.onCreateContextMenu(menu, v, menuInfo);
> menu.setHeaderTitle("Actions menu");
> menu.add(0, 0, 0, "SMS");
> }
>
> public boolean onContextItemSelected(MenuItem item) {
> /* Send SMS */
> try {
> String phone = "123123";
> startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts
> ("sms", phone, null)));
> } catch (ActivityNotFoundException e) {
> Toast.makeText(getBaseContext(), R.string.failed,
> Toast.LENGTH_SHORT).show();
> Log.e("EdithActivity", "SMS Contact failed" );
> }
> return super.onContextItemSelected(item);
> }
>
> }
>
> list_layout xml file:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <ListView xmlns:android="http://schemas.android.com/apk/res/android"
> android:id="@+id/listTabView"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> />
>
> Steps to reproduce the bug:
>
> Start program -> there are two tabs and a list.
> Select list item with longpress -> Context menu appears.
> Click SMS -> SMS app appears.
> Type in few letters and press back -> Toast is displayed, and your are
> back to test activity.
> Try to switch totab2 -> there is no content in tab2! List is not
> displayed!
>
> Make sure you dont go to tab2 first, then it works ok!
> Make sure you type few letters (at least one) in SMS window, if you
> return immediately - it works ok too.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---