Hi Gulfam Instead of... tab.setContent(new Intent(this, SMSSender.class));
Use: Intent i = new Intent(this, SMSSender.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//This will solve your problem tab.setContent(i); On May 20, 8:53 am, Gulfam <[email protected]> wrote: > Hi Guys, > > I am facingStackoverflowerror in SDK1.5_r1 but the same code is > running properly in 1.0_r2 How i can fix it. Below is my app code > > //********************My Main Class*********************// > public class Main extends TabActivity{ > > public void onCreate(Bundle savedInstanceState){ > > super.onCreate(savedInstanceState); > { > > // @Override > TabHost tabHost = getTabHost(); > > tabHost.setHorizontalScrollBarEnabled(true); > TabSpec tab = tabHost.newTabSpec("Tabs"); > > //***************************// > tab = tabHost.newTabSpec("SMS"); > tab.setContent(new Intent(this, SMSSender.class)); > tab.setIndicator("Send SMS",getResources().getDrawable > (R.drawable.info_icon)); > tabHost.addTab(tab); > > } > } > > } > > //**************My Second class only display send sms > view****************// > > public class SMSSender extends Activity { > > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.new_send_sms_ui); > } > > } > > //*************************XML UI*******************************// > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout > > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:orientation="vertical"> > > <!-- ***************Enter Number Add Contacts > Button*************** > --> > > <LinearLayout > android:id="@+id/top_panel" > > android:orientation="horizontal" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > android:paddingTop="5dip" > android:paddingBottom="5dip" > android:paddingLeft="5dip" > android:paddingRight="5dip" > > android:background="#770000ff"> > > <RelativeLayout > > android:id="@+id/toppanel_with_counter" > > android:layout_width="0dip" > > android:layout_height="wrap_content" > > android:layout_weight="1.0" > > android:addStatesFromChildren="true" > > android:background="@android:drawable/edit_text"> > > <EditText > > android:id="@+id/contacts_edit" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:autoText="true" > > android:nextFocusRight="@+id/contacts_list_view_button" > > android:scrollHorizontally="true" > > android:hint="To:" > > android:background="@null" > /> > > </RelativeLayout> > > <Button > > android:id="@+id/contacts_list_view_button" > > android:layout_marginLeft="5dip" > > android:layout_width="wrap_content" > > android:layout_height="fill_parent" > > style="?android:attr/buttonStyle" > > android:layout_gravity="center_vertical" > > android:nextFocusLeft="@+id/contacts_edit" > android:text="Add contacts" > /> > > </LinearLayout> > > <!-- ***************Number Limit Text*************** --> > > <LinearLayout > > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:orientation="vertical"> > > <TextView > android:id="@+id/text_info" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:background="#88000000" > android:textColor="#ffffffff" > android:textSize="11sp" > android:textStyle="bold" > android:paddingLeft="5dip" > android:paddingRight="5dip" > android:layout_alignParentRight="true" > android:text="You can add multiple > numbers from keypad separated > by commas (,). Please enter maximum 25 numbers at a time."/> > </LinearLayout> > > <!-- ***************Compose SMS with Send Button*************** > --> > > <LinearLayout > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:orientation="vertical" > android:background="#00000000" > android:gravity="bottom"> > > <ScrollView > android:layout_width="fill_parent" > android:layout_height="wrap_content"> > > <LinearLayout > > android:id="@+id/bottom_panel" > > android:orientation="horizontal" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:paddingTop="5dip" > > android:paddingBottom="5dip" > > android:paddingLeft="5dip" > > android:paddingRight="5dip" > > android:background="#770000ff"> > > <RelativeLayout > > android:id="@+id/bottompannel_with_counter" > > android:layout_width="0dip" > > android:layout_height="wrap_content" > > android:layout_weight="1.0" > > android:addStatesFromChildren="true" > > android:background="@android:drawable/edit_text"> > > <EditText > > android:id="@+id/edit_sms_txt" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:autoText="true" > > android:capitalize="sentences" > > android:nextFocusRight="@+id/sendSMS_text_button" > > android:hint="Type to compose:" > > android:maxLines="4" > > android:background="@null" > > android:maxLength="960"/> > > </RelativeLayout> > > <Button > > android:id="@+id/sendSMS_text_button" > > android:layout_marginLeft="5dip" > > android:layout_width="wrap_content" > > android:layout_height="fill_parent" > > style="?android:attr/buttonStyle" > > android:layout_gravity="center_vertical" > > android:nextFocusLeft="@+id/edit_sms_txt" > android:text="Send" > /> > > </LinearLayout> > > </ScrollView> > > </LinearLayout> > > </LinearLayout> > > //***************************Now move to > issues************************// > Issue is only on1.5_r1 > > its shows Send SMS screen properly but when i try to select (Type to > compose) text box its givesstackoverflowerrorit showserrorwhen > i use it with (Tab activity) means show send sms ui under the tab. if > i run it with outusingtab activity it runs properly not show anyerroron Both > SDKs. but on 1.0_r2 it runs properly with and without > tab activity. > Issue is only on1.5_r1with tabs. How i can Fix it. Any one can build > it and help me regarding this. where i am wrong ? please correct those > lines where I m wrong thanks in advance > > //************************Its Exception which I m > facing***************************// > > 05-19 17:50:34.121:ERROR/AndroidRuntime(844): Uncaught handler: > thread main exiting due to uncaught exception > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): > java.lang.StackOverflowError > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Styled.measureText(Styled.java:371) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Layout.measureText(Layout.java:1477) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Layout.getHorizontal(Layout.java:529) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Layout.getHorizontal(Layout.java:513) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Layout.getPrimaryHorizontal(Layout.java:498) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.text.Layout.getCursorPath(Layout.java:1094) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.widget.TextView.onDraw(TextView.java:3839) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5838) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5841) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5841) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5944) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.widget.FrameLayout.draw(FrameLayout.java:352) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5841) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1484) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.View.draw(View.java:5841) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.widget.FrameLayout.draw(FrameLayout.java:352) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1486) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.drawChild(ViewGroup.java:1484) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): at > android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) > 05-19 17:50:34.141:ERROR/AndroidRuntime(844): ... > > read more » --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

