Skip to main content

Posts

Showing posts with the label update

iPhone: Sqlite update or insert row

I want to update the quantity if the menuid is already available otherwise add a new row. I used the following code.But no row is added or updated. sqlite3 *database; sqlite3_stmt *addStmt=nil; if (selection== nil) { selection =@"Medium"; } if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) { const char *select="select quantity from item where menuid = ?"; sqlite3_stmt *selectstmt; if(sqlite3_prepare_v2(database, select, -1, &selectstmt, NULL) == SQLITE_OK) { while(sqlite3_step(selectstmt) == SQLITE_ROW) { menuID= [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 0)]; char *quant = (char *)sqlite3_column_text(selectstmt,1); quantity=[NSString stringWithUTF8String:(char *)quant]; // [self.ids addObject:menuID]; } sqlite3_reset(selectstmt);

How to refresh BlackBerry ui page on button click?

I may seem ignorant but I have not found much information about how to go about my problem developing my BlackBerry application. Basically I have constructed a UI that contains a few image buttons. What I want to do is when I click on one of the buttons, I want an image at the center of the screen to switch seemlessly to another image. I am currently not using any threads though from what I've gathered I need to? Or do I simply have to push a new screen in my button listener and recall the class's constructor and rebuild the page with different images? Sorry if this is unclear, I would really appreciate some basic info on how to do this or a link that explains page refreshing in detail for blackberry! Thanks alot EDIT : Okay here is a very small part of my code : This is basically the last thing I have tried in the listeners, I dont know how to change the image (flagField) when I press one of the two buttons! The only thing that worked for me was pushScreen(new

Viewpager doesn't update/loads xml items

I solved the question with onclicklistsner issue with viewpager but now I noticed, that it depends on all Elements in XML Layout files. I implemented a ViewPager with that Tutorial: tutsplus Now I have the Problem, that all the Objects I defined in XML are instantiated correct (not null in Debuggin mode after findViewById etc) but I can't reffer to them. To understand it better here my PagerAdapter: class MyPagerAdapter extends PagerAdapter { public int getCount() { return 3; } public Object instantiateItem(View collection, int position) { LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.settings_view; break; case 1: resId = R.layout.push_view; break; case 2: resId = R.layout.listen_view; break;