Permalink
Browse files

Build a List of Time Zones

  • Loading branch information...
dragosholban committed Mar 10, 2018
1 parent f867a87 commit 338756e0a2f5389b16f01e31f1dc8904f2e14295
@@ -2,12 +2,23 @@
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.TimeZone;
public class TimeZoneActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_time_zone);
ListView listView = findViewById(R.id.listView);
ArrayList<String> timezones = new ArrayList<>(Arrays.asList(TimeZone.getAvailableIDs()));
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, timezones);
listView.setAdapter(adapter);
}
}
@@ -6,4 +6,18 @@
android:layout_height="match_parent"
tools:context="dragosholban.com.timezoneconverter.TimeZoneActivity">
<ListView
android:id="@+id/listView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

0 comments on commit 338756e

Please sign in to comment.