![]() IsTracked = cursor.getInt(cursor.getColumnIndex("isTracked")) = 1 ? true : false ĭeclare the column names as constants as done for table name.Īdditionally, create DbHelper class by extending SQLiteOpenHelper for accessing and managing the database. Name = cursor.getString(cursor.getColumnIndex("name")) Ĭode = cursor.getString(cursor.getColumnIndex("code")) Id = cursor.getLong(cursor.getColumnIndex("_id")) Ĭountry = cursor.getString(cursor.getColumnIndex("country")) Public class Symbol extends AbstractModel, null, null, null) Additionally, we implement CRUD (create, read, update, delete) functionality in the model class itself. ![]() The data model classes are simple Java beans with attributes and getters/setters corresponding to the table columns. Currency converter application android studio project using java language, here we can convert the U.S currency into Indian Currency. ![]() The Quote table holds the exchange rates between currencies and other useful information which would be updated regularly.Ĭreate a package to hold the data model classes. The Symbol table holds basic information about each currency such as its name, country, ISO code, and whether the user is tracking the currency. The data model of the application comprises of two tables. The project gets created in your workspace. In New Android Project dialog enter the project details as follows.Ĭlick Finish. In Eclipse, go to File > New > Project and in the New Project dialog, expand Android folder to select Android Project. There is also a settings screen which we cover in the tutorial. There is a search mechanism available in the main screen which allows user to search a currency and add it to the list. And the details screen uses AChartEngine library to render the chart. The main screen is implemented using a ListView with custom layout for the rows. Apart from these we also allow user to check historical exchange rates which involves plotting charts using third party libraries like AChartEngine. Even if you do neither of these you'd still find it interesting to check the exchange rates of world currencies and how they vary over time.ĭeveloping a currency converter app is a good way of learning Android development as it involves a lot of concepts such as making REST calls, parsing the data, storing into a database, as well as updating the data in background. If you travel to foreign countries or do forex trading then you already know the utility of such an application. Without the Y! side re-packaging of the individual exchange rates.In this tutorial we show how to create a currency converter app in Android. Which retuns as simple data as: "GBPJPY=X","GBP/JPY",146.7220 Var tag = ().toString().substr(0,6) Īnother way would be to build a set of direct access-iterators that re-use Y! direct access query syntax for returning a single csv-record for each respective currency pair, without Y! side aggregation of results into a common container: "&f=snl1d1t1ab'" + " and columns='Symbol,Name,Rate,Date,Time,Ask,Bid'", Var q = "select * from csv where url='"+ pairs.join(',') + This approach relies on Y! side processing, as detailed in API specification: įor each (var p in pair.toString().replace(/\s+/g,'').split(',')) String aQuerySTRING = sendMeTheYahooApiQuerySTRING( "DKK", anErrorFLAG ) ) ĭesigned so as to use it later in: bool anErrorFLAG = False )&env=store:///alltableswithkeys" ) Ĭase. )&env=store:///alltableswithkeys" ) Ĭase "JPY": ErrorFLAG = False return( " * from where pair in ( "GBPJPY", "JPYBGN". The simplest way is to prepare a static convertor, responsible for returning the pre-assembled list, that will return ( send you ) the Yahoo API Querystring.Ī trivial mock-up example is: string sendMeTheYahooApiQuerySTRING( const string aCurrency1 = "USD",Ĭase "USD": ErrorFLAG = False return( " * from where pair in ( "USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK", "USDGBP", "USDHUF", "USDLTL", "USDLVL", "USDPLN", "USDRON", "USDSEK", "USDCHF", "USDNOK", "USDHRK", "USDRUB", "USDTRY", "USDAUD", "USDBRL", "USDCAD", "USDCNY", "USDHKD", "USDIDR", "USDILS", "USDINR", "USDKRW", "USDMXN", "USDMYR", "USDNZD", "USDPHP", "USDSGD", "USDTHB", "USDZAR", "USDISK" )&env=store:///alltableswithkeys" ) Ĭase "GBP": ErrorFLAG = False return( " * from where pair in ( "GBPEUR", "GBPJPY", "GBPBGN", "GBPCZK", "GBPDKK", "USDGBP". Please send me Yahoo API Querystring which fit my requirement. I want to pass USD and return me all the exchange rates for all the other countries. I don't want to write currency pairs one by one. In this API I have to write one by one currency pairs for each country. Where pair in ( "USDEUR", "USDJPY", "USDBGN", "USDCZK", I have search on google I find following Yahoo API * from I need Yahoo API, which will return exchange rates of all country on country based I pass.įor example I will pass USD as a base, then Yahoo API should return me exchange rates of all other countries.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |