Thursday 28 October 2010

Desire HD Drivers

I've just got the Desire HD. I was not able to run my application from eclipse to my device as it was not recognised. No Drivers??!!

I solved this by mounting my phone, going to HTC Sync on the SD card. Unplug the phone, whack it back in and it installs itself.

Tuesday 19 October 2010

Android Text Strikethrough

I'm including a shopping list in my application. Do make an effective list I wanted to change the text of a selected item to be Strikethrough Easy to do in HTML and android handles HTML.. BUT this tag won't work in a dynamic strink.

So to format the text use

textview.setPaintFlags(textview.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

Sorted

Saturday 16 October 2010

Switching Activies with OnClick

I've read through a lot of examples of how to switch through an activity but I have found that when you create your menu page activity the best practise is to implement the onlick listener directly.

This way you can easily and quickly code your buttons in one case statement




public class Example extends Activity implements OnClickListener

View btnExample = (ImageButton)findViewById(R.id.btnExample);
btnNewItem.setOnClickListener(this);

//On click for the buttons
@Override
public void onClick(View v) {

switch (v.getId()){
case R.id.btnExample:
startActivity(new Intent(this, MainList.class));
break;
//Add more if needed

SQLite, Create View Example

I've been having some issues with SQLite. I'm a confident SQL programmer and use it day to day. But some things are just different with SQLite and for some reason it's been taking me ages to find examples on such simple things such as views. I could find any good material for creating a view... correct me if there is something out there that I've missed.

Views are simple but need to be done in the correct place with the correct syntax.

This is a VERY basic view.. No INNER JOINS or anything. Ensure that the CREATE VIEW ect is in capitals otherwise it won't work! unlike the create table which does...




private static final String VIEW1 =
"CREATE VIEW inventoryview AS SELECT items.item, items.category, " +
"items.price, lists.listname, listitem.status, inventory.bbf, " +
"listitem.listid, listitem.itemid, listitem.quantity " +
"FROM items, lists, listitem, inventory " +
"WHERE " +
"listitem.itemid=items._id AND " +
"listitem.itemid=inventory.itemid AND " +
"listitem.listid=lists._id;";


@Override
public void onCreate(SQLiteDatabase db)
{ try{

db.execSQL(VIEW1);
}catch (Exception e)
{
Log.e("Create Error", e.toString());
e.printStackTrace();

}}


Easy Peasy

Resources

I've been reading a book today called Hello, Android.

Great book for newbies as it describes all of the features you will need to start developing. The first things you do in a new development platform are usually the hardest as you have no idea. Read this and it suddenly all makes sense.

Wednesday 13 October 2010

The Project

So like any other final year project there is an academic question

Can an application help manage food storage in a household?


The aim of the project is to provide an easy to use, smart android based solution to managing food in a household to prevent waste and to improve food usage.

To do this I aim to provide functionallity to create a list of items you currently have stored in your kitchen and the best before dates.

This list can be created in a number of ways, such as; by adding individual items by selection or barcode, or importing a shopping list which is created on the application.

I aim to provide recipies based on the current inventry items.

I would also like to provide functionallity to share the list in a number of ways such as;

Facebook
Email
Website
mySupermarket
Tesco

My Android Journey

I am studying computer science and I'm doing my final year project.
for my final year project I'm going to be developing an Android application, This blog will track my process