Dear Blog Viewer,
Monday, October 3, 2011
Tuesday, September 20, 2011
How to Change Tab Name from Activity in Android
Tabs in the Android work with TabWidgets.
Contained in the tabwidget are relative layouts for each of your tabs which each contain an imageview and a textview.
Tab index will start from 0 and to access the Tab Contents use the following steps.
For Example. if you want to access title of tab
mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title);
the above statement will provide the view (TextView) at this position.
change the text of Tab
TextView v = ((TextView)mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title));
v.setText("My New Title");
Congratulations.
Your text of tab is changed.
Wednesday, September 14, 2011
How to Convert InputStream to String In Java
Here is the Simple method to convert InputStream Object to String Object.
Just Call this method and pass InputStream Object. it return the String
Just Call this method and pass InputStream Object. it return the String
public static String convertStreamToString(InputStream is) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
is.close();
return sb.toString();
}
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
is.close();
return sb.toString();
}
Subscribe to:
Posts (Atom)