Skip to content

Commit acbda9d

Browse files
author
javatechig
committed
Simple Lsit android project added
1 parent 2f5e7cc commit acbda9d

File tree

14 files changed

+149
-0
lines changed

14 files changed

+149
-0
lines changed

SimpleList/AndroidManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.javatechig.droid.ui"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="8"
9+
android:targetSdkVersion="8" />
10+
11+
<application
12+
android:allowBackup="true"
13+
android:icon="@drawable/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme" >
16+
<activity
17+
android:name="com.javatechig.droid.ui.ListActivity"
18+
android:label="@string/app_name" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
27+
</manifest>

SimpleList/ic_launcher-web.png

54.4 KB
Loading
377 KB
Binary file not shown.

SimpleList/proguard-project.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

SimpleList/project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-8
8.02 KB
Loading
2.5 KB
Loading
3.97 KB
Loading
13.2 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical"
6+
tools:context=".ListActivity" >
7+
8+
<ListView
9+
android:id="@+id/months_list"
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content" >
12+
</ListView>
13+
14+
</LinearLayout>

SimpleList/res/menu/activity_list.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<item
4+
android:id="@+id/menu_settings"
5+
android:orderInCategory="100"
6+
android:title="@string/menu_settings"/>
7+
8+
</menu>

SimpleList/res/values/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">AndroidListView</string>
5+
<string name="hello_world">Hello world!</string>
6+
<string name="menu_settings">Settings</string>
7+
8+
</resources>

SimpleList/res/values/styles.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.javatechig.droid.ui;
2+
3+
import android.os.Bundle;
4+
import android.app.Activity;
5+
import android.widget.ArrayAdapter;
6+
import android.widget.ListView;
7+
8+
public class ListActivity extends Activity {
9+
10+
// Initialize the array
11+
String[] monthsArray = { "JAN", "FEB", "MAR", "APR", "MAY", "JUNE", "JULY", "AUG", "SEPT", "OCT", "NOV", "DEC" };
12+
13+
// Declare the UI components
14+
private ListView monthsListView;
15+
16+
private ArrayAdapter arrayAdapter;
17+
18+
/** Called when the activity is first created. */
19+
@Override
20+
public void onCreate(Bundle savedInstanceState) {
21+
super.onCreate(savedInstanceState);
22+
setContentView(R.layout.activity_list);
23+
24+
// Initialize the UI components
25+
monthsListView = (ListView) findViewById(R.id.months_list);
26+
// For this moment, you have ListView where you can display a list.
27+
// But how can we put this data set to the list?
28+
// This is where you need an Adapter
29+
30+
// context - The current context.
31+
// resource - The resource ID for a layout file containing a layout to use when instantiating views.
32+
// From the third parameter, you plugged the data set to adapter
33+
arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, monthsArray);
34+
35+
// By using setAdapter method, you plugged the ListView with adapter
36+
monthsListView.setAdapter(arrayAdapter);
37+
}
38+
}

0 commit comments

Comments
 (0)