I have wasted a lot of time before i figured it out, when tried to create EditItem activity.
5/31/12
How to add a new activity
When you adding new activity to project you must register it in AndroidManifest.xml.
I have wasted a lot of time before i figured it out, when tried to create EditItem activity.
I have wasted a lot of time before i figured it out, when tried to create EditItem activity.
5/25/12
Notepad Sample application-used inspiration for me
I have learned a lot from exploring Notepad Sample application from SDK samples . If you want to import it to your local namespace in Eclipse you only need:
in dialog that opens you have to select 'from exisitng sample':
choose tagret system and in the next dialog-many samples you can import and play with:
in dialog that opens you have to select 'from exisitng sample':
choose tagret system and in the next dialog-many samples you can import and play with:
5/22/12
Database structure
Database structure of application will be as much simple as possible:
There will be two tables: lists and items :
Usualy, in android, SqlLite database is used. Here is the code i wrote for creating the database :
There will be two tables: lists and items :
Usualy, in android, SqlLite database is used. Here is the code i wrote for creating the database :
//create lists table private static final String LISTS_TABLE_CREATE = "create table lists (" +"_id integer primary key autoincrement, " +" listName text not null" +" );"; //create items table private static final String ITEMS_TABLE_CREATE = "create table list_items (" +"_id integer primary key autoincrement, " +" isdone boolean not null DEFAULT false," +" title text not null," +" list_id integer," +" quantity integer not null DEFAULT 1," +" FOREIGN KEY(list_id) REFERENCES lists(_id)" +" );"; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DBAdapter(Context ctx) { this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { try { db.execSQL(LISTS_TABLE_CREATE ); db.execSQL(ITEMS_TABLE_CREATE ); } catch (Exception e){ e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {/* Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");*/ db.execSQL("DROP TABLE IF EXISTS " + ITEMS_TABLE_NAME); db.execSQL("DROP TABLE IF EXISTS " + LISTS_TABLE_NAME); onCreate(db); } }
5/20/12
How to make screen (or window) in Adndroid
In android programming, screen or window object named Activity.
Here is example code that display list of items from simple strings array :
When you run the code you got something like this:
Here is example code that display list of items from simple strings array :
public class NisuiActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv= (ListView)findViewById(R.id.listview); // create the grid item mapping String[] from = new String[] {"rowid"}; int[] to = new int[] { R.id.item1 }; // prepare the list of all records List<hashmap<string, string>> fillMaps = new ArrayList<hashmap<string, string>>(); for(int i = 0; i < 10; i++){ HashMap<string, string> map = new HashMap<string, string>(); map.put("rowid", "" + i); fillMaps.add(map); } // fill in the grid_item layout SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.grid_item, from, to); lv.setAdapter(adapter); } }
When you run the code you got something like this:
5/17/12
Planing Design
Now i'm trying to plan the views.
I think the application will consist from two views:
1. all the lists (for managing all lists)
2. items of current list (for managing items)
I'm not good designer at all, as you can see from my design.
But here is all list screen:
I think the application will consist from two views:
1. all the lists (for managing all lists)
2. items of current list (for managing items)
I'm not good designer at all, as you can see from my design.
But here is all list screen:
And here is Items screen - where user will be able to check , delete and edit items:
5/16/12
Open repository at Github
In purpose to do things in a professional way (like many other decent developers) - i decided to open my own repository at github. In github the source will be accessible to everyone who want to see it
Today i created my first repository , and you can see the source here, or download it by press ZIP button
Today i created my first repository , and you can see the source here, or download it by press ZIP button
5/15/12
The Very simple android app i desided to build
I decided to build simple android shopping list application, to try my skills in this hot programming field.
Since I'm completely new to android and to java it is very interesting experiment if i will succeed...
The shopping list application -is for help the people who going to shop, to remember what they planned to buy.
Something like Out Of Milk Application (No way my application will be good as OutOfMilk, but i must start somewhere if i want to learn android development...)
All the products the user plan to buy are displayed in list along with 'done' checkbox - which indicates if product is already in the cart.
Since I'm completely new to android and to java it is very interesting experiment if i will succeed...
The shopping list application -is for help the people who going to shop, to remember what they planned to buy.
Something like Out Of Milk Application (No way my application will be good as OutOfMilk, but i must start somewhere if i want to learn android development...)
All the products the user plan to buy are displayed in list along with 'done' checkbox - which indicates if product is already in the cart.
Subscribe to:
Posts (Atom)
Getting started with docker
It is very simple to get started usig docker. All you need to do-is download the docker desktop for your system Once you get docker syste...
-
This button must show the list of users who answered the survey. Which survey? The one with its checkbox checked, of course : This code i...
-
When you about to do your first PR (pull request) it is important to know how to squash commits correctly. Why? you may ask - Well i know...
-
Directive in contemporary angular - means piece of code which doing something on the html block is attached to as attribute. For example l...