krishnaveni
Well-Known Member
In my Android application I have to display article title on corresponding category.
I wish to display the output in following format:
[HIGH]Languages Programming --- Category name on Horizontal listview[/HIGH]
If I have to click Languages which means getting the article title for that selected category alone and displaying on Horizontal listview.
[HIGH]Languages Programming
Tamil Engilsh Hindi Telugu[/HIGH]
If I have to click Programming means need to display the :
[HIGH]Languages Programming
Java C C++[/HIGH]
Now my current status is :
I have to run the app and click Languages which means getting the output is :
Languages Programming
Tamil English Hindi
After that I have to click Programming means getting the output is :
Languages Programming
Tamil English Hindi
What's wrong in my code? Why am getting the same output on my app screen? But i got the correct article titles on my console window. I have facing problem only on my app screen only..
What's wrong in my code ... please give me solution for these ...
[HIGH]public void updateDetail(String categorytitle,int object) {
lblName.setText(categorytitle);
System.out.println("The Category name is "+categorytitle);
String strI = Integer.toString(object+1);
String[] stockArr = new String[Appscontent.Sub_arraylist.size()];
stockArr = Appscontent.Sub_arraylist.toArray(stockArr);
for (String s : stockArr)
{
if (s.startsWith(strI))
{
String _Substring;
_Substring = s.substring(1);
Appscontent.Sub_arraylisttwo.add(_Substring);
}
}
//pass the article title
hSroll = new HorizontalScrollView(getActivity());
lLayout = new LinearLayout(getActivity());
lLayout.setOrientation(LinearLayout.HORIZONTAL);
lLayout.setLayoutParams(lLayoutLayoutParams);
lLayout.setHorizontalScrollBarEnabled(true);
lLayout.setGravity(Gravity.CENTER);
for(int j = 0; j < Appscontent.Sub_arraylisttwo.size(); j++)
{
LinearLayout ly = new LinearLayout(getActivity());
ly.setOrientation(LinearLayout.VERTICAL);
ly.setBackgroundColor(Color.parseColor("#666666"));
ly.setLayoutParams(articleLayoutParams);
ly.setPadding(1, 1, 1, 1);
ly.setOnClickListener(mArticleClick);
ly.setId(position);
position++;
TextView tv = new TextView(getActivity());
tv.setHorizontallyScrolling(false);
tv.setTextColor(Color.parseColor("#FFFFFF"));
tv.setText(Appscontent.Sub_arraylisttwo.get(j));
System.out.println("The article title is "+Appscontent.Sub_arraylisttwo.get(j));
ly.addView(tv);
lLayout.addView(ly);
}
int num = Integer.parseInt(strI);
strI = String.valueOf(num = num + 1);
Appscontent.Sub_arraylisttwo.clear();
Appscontent.Sub_arraylistdessub.clear();
Appscontent.Sub_arraylistimagesub.clear();
Appscontent.Sub_arraylistcontentsub.clear();
Appscontent.Sub_arraylistvideosub.clear();
hSroll.addView(lLayout);
verticalLayout.addView(hSroll);
}[/HIGH]
Please review my code and give me solution for these...am getting the correct output on my console window.But i didn't get the output on my android app screen...
My console window output is :
When clicked Languages means
[HIGH]The Category name is Languages
The article title is Tamil
The article title is English
The article title is Hindi
The article title is Telugu[/HIGH]
After that i have clicked Programming means
[HIGH]
The Category name is Programming
The article title is Java
The article title is c
The article title is C++[/HIGH]
please review my code and give me solution ...
I wish to display the output in following format:
[HIGH]Languages Programming --- Category name on Horizontal listview[/HIGH]
If I have to click Languages which means getting the article title for that selected category alone and displaying on Horizontal listview.
[HIGH]Languages Programming
Tamil Engilsh Hindi Telugu[/HIGH]
If I have to click Programming means need to display the :
[HIGH]Languages Programming
Java C C++[/HIGH]
Now my current status is :
I have to run the app and click Languages which means getting the output is :
Languages Programming
Tamil English Hindi
After that I have to click Programming means getting the output is :
Languages Programming
Tamil English Hindi
What's wrong in my code? Why am getting the same output on my app screen? But i got the correct article titles on my console window. I have facing problem only on my app screen only..
What's wrong in my code ... please give me solution for these ...
[HIGH]public void updateDetail(String categorytitle,int object) {
lblName.setText(categorytitle);
System.out.println("The Category name is "+categorytitle);
String strI = Integer.toString(object+1);
String[] stockArr = new String[Appscontent.Sub_arraylist.size()];
stockArr = Appscontent.Sub_arraylist.toArray(stockArr);
for (String s : stockArr)
{
if (s.startsWith(strI))
{
String _Substring;
_Substring = s.substring(1);
Appscontent.Sub_arraylisttwo.add(_Substring);
}
}
//pass the article title
hSroll = new HorizontalScrollView(getActivity());
lLayout = new LinearLayout(getActivity());
lLayout.setOrientation(LinearLayout.HORIZONTAL);
lLayout.setLayoutParams(lLayoutLayoutParams);
lLayout.setHorizontalScrollBarEnabled(true);
lLayout.setGravity(Gravity.CENTER);
for(int j = 0; j < Appscontent.Sub_arraylisttwo.size(); j++)
{
LinearLayout ly = new LinearLayout(getActivity());
ly.setOrientation(LinearLayout.VERTICAL);
ly.setBackgroundColor(Color.parseColor("#666666"));
ly.setLayoutParams(articleLayoutParams);
ly.setPadding(1, 1, 1, 1);
ly.setOnClickListener(mArticleClick);
ly.setId(position);
position++;
TextView tv = new TextView(getActivity());
tv.setHorizontallyScrolling(false);
tv.setTextColor(Color.parseColor("#FFFFFF"));
tv.setText(Appscontent.Sub_arraylisttwo.get(j));
System.out.println("The article title is "+Appscontent.Sub_arraylisttwo.get(j));
ly.addView(tv);
lLayout.addView(ly);
}
int num = Integer.parseInt(strI);
strI = String.valueOf(num = num + 1);
Appscontent.Sub_arraylisttwo.clear();
Appscontent.Sub_arraylistdessub.clear();
Appscontent.Sub_arraylistimagesub.clear();
Appscontent.Sub_arraylistcontentsub.clear();
Appscontent.Sub_arraylistvideosub.clear();
hSroll.addView(lLayout);
verticalLayout.addView(hSroll);
}[/HIGH]
Please review my code and give me solution for these...am getting the correct output on my console window.But i didn't get the output on my android app screen...
My console window output is :
When clicked Languages means
[HIGH]The Category name is Languages
The article title is Tamil
The article title is English
The article title is Hindi
The article title is Telugu[/HIGH]
After that i have clicked Programming means
[HIGH]
The Category name is Programming
The article title is Java
The article title is c
The article title is C++[/HIGH]
please review my code and give me solution ...