How are you old - date calendar age Java Android example
Calendar dateOfYourBirth = new GregorianCalendar(1998, Calendar.SEPTEMBER, 17); Calendar today = Calendar.getInstance(); Android example.
public class HoriziontalScrollActivity extends Activity {
TextView txtV;
Context cntx;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtV = (TextView)findViewById(R.id.idLabel);
cntx = this;
StringBuilder strBuild = new StringBuilder();
// enter your date of birth
Calendar dateOfYourBirth = new GregorianCalendar(1998, Calendar.SEPTEMBER, 17);
Calendar today = Calendar.getInstance();
int yourAge = today.get(Calendar.YEAR) - dateOfYourBirth.get(Calendar.YEAR);
dateOfYourBirth.add(Calendar.YEAR, yourAge);
if (today.before(dateOfYourBirth)) {
yourAge--;
}
strBuild.append("You are " + yourAge + " old!");
txtV.setText(strBuild);
}
}
396LW NO topic_id
AD
Další témata ....(Topics)
In your project AndroidManifest.xml you can set permission of Android application example source code.
For example if you want allow your application connection to INTERNET you have to permit this in AndroidManifest.xml.
WebViev show error: Website Not Available you have to permit INTERNET
For example if you want allow your application connection to INTERNET you have to permit this in AndroidManifest.xml.
WebViev show error: Website Not Available you have to permit INTERNET
<uses-permission
android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.GET_ACCOUNTS" />
<uses-permission
android:name="android.permission.USE_CREDENTIALS" />
<uses-permission
android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission
android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission
android:name="android.permission.WRITE_SETTINGS" />
<uses-permission
android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission
android:name="android.permission.READ_CONTACTS" />
<uses-permission
android:name="android.permission.WRITE_CONTACTS" />
<uses-permission
android:name="android.permission.READ_SYNC_STATS" />
<uses-permission
android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission
android:name="android.permission.WRITE_SYNC_SETTINGS" />
Delete - unistal app from testing device - emulator and try again RUN - DEBUGG your app.
Warning: The application may be doing too much work on its main thread
Try this sorce code:
Try this sorce code:
import android.os.StrictMode;
public class MyActivity extends Activity {
static{
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
@Override
public void onCreate(Bundle savedInstanceState) {
//.................. etc.
Samsung Galaxy Ace nejlepší cena od 4 500 KCZ Kč (únor.2012)
Samsung Galaxy Ace je chytrý telefon s operačním systémem Android.
Samsung Galaxy Ace je (22.února2012) 4. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Galaxy Ace je 3.5G smartphone nabízí i quad-band GSM. Displej je 3,5 palcový TFT kapacitní dotykový LCD HVGA s (320x480) rozlišením. K dispozici je také 5 megapixelový fotoaparát s LED bleskem. Je schopny zaznamenat video v rozlišení QVGA (320x240) a VGA s (640x480) rozlišením. Ace je dodáván s 1350mAh Li-Ion baterií. Ace běží s OS Android 2.2 Froyo a lze jej upgradovat na Android 2.3.6 Gingerbread.
Samsung Galaxy Ace photo pic image
Zdroj obrázku: wikipedia
Samsung Galaxy Ace je chytrý telefon s operačním systémem Android.
Samsung Galaxy Ace je (22.února2012) 4. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Galaxy Ace je 3.5G smartphone nabízí i quad-band GSM. Displej je 3,5 palcový TFT kapacitní dotykový LCD HVGA s (320x480) rozlišením. K dispozici je také 5 megapixelový fotoaparát s LED bleskem. Je schopny zaznamenat video v rozlišení QVGA (320x240) a VGA s (640x480) rozlišením. Ace je dodáván s 1350mAh Li-Ion baterií. Ace běží s OS Android 2.2 Froyo a lze jej upgradovat na Android 2.3.6 Gingerbread.
Samsung Galaxy Ace photo pic image
Zdroj obrázku: wikipedia
TableRow TableLayout table row add delete remove removeview addview get table row index indexOfChild create table row dynamically TextView dynamically Android example
Main.java
main.xml ScrollView, TableLayout, TableRow, TextView Android xml layout example
Main.java
TableLayout table = (TableLayout)findViewById(R.id.table);
TableRow row = (TableRow)findViewById(R.id.row);
// get table row index android.
int nIndex = table.indexOfChild(row);
table.removeView(row); // invisible and height == 0
// add row into same place
table.addView(row, nIndex); // visible
// add row into certain position
table.addView(row, 3); // visible
// create new TableRow dynamically
TableRow tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
// create own function for append TableRow
private void appendRow(TableLayout table) {
TableRow row = new TableRow(this);
TextView hLabel = new TextView(this);
hLabel.setText("Some text");
hLabel.setPadding(3, 3, 3, 3);
TextView hNextLabel = new TextView(this);
hNextLabel.setText("Next text");
hNextLabel.setPadding(3, 3, 3, 3);
hNextLabel.setGravity(Gravity.RIGHT | Gravity.TOP);
row.addView(hLabel, new TableRow.LayoutParams(1));
row.addView(hNextLabel, new TableRow.LayoutParams());
table.addView(row, new TableLayout.LayoutParams());
}
main.xml ScrollView, TableLayout, TableRow, TextView Android xml layout example
<ScrollView xmlns:android="//schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:id="@+id/table"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Row index 0"/>
</TableRow>
<TableRow android:id="@+id/row">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Row index 1"/>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Row index 2"/>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Row index 3"/>
</TableRow>
</TableLayout>
</ScrollView>
Editace: 2011-09-29 21:08:34
Počet článků v kategorii: 396
Url:how-are-you-old-date-calendar-age-java-android-example