Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
1181-1181/com.national.nhl E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.national.nhl, PID: 1181
java.lang.StackOverflowError
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5712)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714)
I have used Tablelayout as an view that is shown on Alert Dialog like this,
rowLink=(TableLayout)getLayoutInflater().inflate(R.layout.details, null);
rowLink.addView(rowLink);
((ViewGroup)rowLink.getParent()).removeView(rowLink);
tvrgp=(TextView)rowLink.findViewById(R.id.tvrgp);
tvrg=(TextView)rowLink.findViewById(R.id.tvrg);
tvra=(TextView)rowLink.findViewById(R.id.tvra);
tvrp=(TextView)rowLink.findViewById(R.id.tvrp);
tvrplusminus=(TextView)rowLink.findViewById(R.id.tvrplusminus);
tvrpim=(TextView)rowLink.findViewById(R.id.tvrpim);
Document doc = Jsoup.connect(temp).get(); //temp is url of webiste
Element regularseason = doc.getElementsByTag("table").get(3);
Elements tbody=regularseason.select("tbody");
Elements row = tbody.select("tr");
Element vrgp = row.select("td").get(1);
Element vrg = row.select("td").get(2);
Element vra = row.select("td").get(3);
Element vrp = row.select("td").get(4);
Element vrplusminus=row.select("td").get(5);
Element vrpim = row.select("td").get(6);
tvrgp.setText(vrgp.text().trim());
tvrg.setText(vrg.text().trim());
tvra.setText(vra.text().trim());
tvrp.setText(vrp.text().trim());
tvrplusminus.setText(vrplusminus.text().trim());
tvrpim.setText(vrpim.text().trim());
}catch(Exception ex)
{ ex.printStackTrace();}
.setTitle("player")
.setView(rowLink)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}).show();
its get data in my htc desire s shows all text-views on alertDialog and all the value that is fetch from internet, but when i run it on Emulator or other Android Devices it says force close with the above logcat,
Help me if any one know the solution.
Thanks in Advance
Edit:
Details.xml
android:id="@+id/row1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:textColor="#FFFFFF"
android:id="@+id/statistics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:typeface="serif"
android:textSize="18dp"
android:background="#010101"
android:gravity="center"
android:padding="2dp"
android:layout_span="3"></TextView>
android:id="@+id/row2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:background="#010101"
android:textColor="#FFFFFF"
android:id="@+id/titlenew"
android:text=""
android:gravity="center"
android:textStyle="bold"
android:typeface="serif"
android:padding="4dp"
android:layout_margin="1dp">
</TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:text="REGULAR SEASON"
android:id="@+id/titleregular"
android:textStyle="bold"
android:layout_width="wrap_content"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:text="LEAGUE RANK"
android:id="@+id/titleleague"
android:textStyle="bold"
android:layout_width="wrap_content"
android:background="#010101"
android:padding="4dp"></TextView>
android:id="@+id/row3"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
android:gravity="center_horizontal"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvlgp"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
android:id="@+id/row4"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:textColor="#FFFFFF"
android:id="@+id/titleg"
android:text="G"
android:layout_margin="1dp"
android:gravity="center"
android:textStyle="bold"
android:typeface="serif"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:id="@+id/tvrg"
android:gravity="center_horizontal"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvlg"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
android:id="@+id/row5"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:id="@+id/titlea"
android:gravity="center"
android:text="A"
android:textStyle="bold"
android:typeface="serif"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:id="@+id/tvra"
android:gravity="center_horizontal"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:textColor="#FFFFFF"
android:layout_margin="1dp"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvla"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
android:id="@+id/row6"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:id="@+id/titlep"
android:text="P"
android:gravity="center"
android:textStyle="bold"
android:typeface="serif"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvrp"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvlp"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
android:id="@+id/row7"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:id="@+id/titleplusminus"
android:text="+/-"
android:gravity="center"
android:textStyle="bold"
android:typeface="serif"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvrplusminus"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvlplusminus"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
android:id="@+id/row8"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:text="PIM"
android:id="@+id/titlepim"
android:gravity="center"
android:textStyle="bold"
android:typeface="serif"
android:background="#010101"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvrpim"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
<TextView
android:layout_margin="1dp"
android:textColor="#FFFFFF"
android:background="#010101"
android:textStyle="bold"
android:id="@+id/tvlpim"
android:gravity="center_horizontal"
android:padding="4dp"></TextView>
–
–
–
–
I think You have (way) too many nested layouts. You can check out the official Android blog at d.android.com to get tips and tricks on how to optimize layouts.
There are two ways to do this Split your code into different xmls then
Use Fragments : refer thins link Need detailed explanation on android fragments
Use include tag : refer this link: Nested tag
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.