-
Recent Posts
Recent Comments
- vidya on Toolbar overlapping listView
- wpadmin on SAX parser using AsyncTask to read xml file on net
- Free Stuff on SAX parser using AsyncTask to read xml file on net
- Crave Freebies on SAX parser using AsyncTask to read xml file on net
- wpadmin on Resources references from the manifest cannot vary by configuration
Archives
- September 2018
- July 2018
- June 2018
- October 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- December 2016
- June 2016
- March 2016
- February 2016
- November 2015
- May 2015
- January 2015
- April 2014
- March 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
Categories
Meta
Monthly Archives: July 2013
Check whether service running
Method found on stackoverflow but it doesn’t appear to be the best answer. After stopping a service, this method may still see it as running. This is presumably because android will clear it our in its own time. The method I … Continue reading
Posted in Android
Leave a comment
Get & set text on view
To get a string/value: EditText e1 = (EditText)findViewById(R.id.count2a); int i = Integer.parseInt(e1.getText().toString()); To set from an activity: ((TextView)findViewById(R.id.score)).setText(Integer.toString(score)); To set from a fragment: ((TextView)view.findViewById(R.id.textView1)).setText(myCurrency1); To use a string from strings.xml: ((Button)findViewById(R.id.button2)).setText(R.string.sched_stop);
Posted in Android
Leave a comment
Download xml file & write to sd card
1. Download xml file The solution that suited me best was largely built on this stackoverflow entry. I put it in an AsyncTask. Remember manifext update: <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE”></uses-permission> <uses-permission android:name=”android.permission.INTERNET”></uses-permission> <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”></uses-permission> In main activity. URL url = null; try … Continue reading
Posted in Android
Leave a comment
Pass data from fragment to activity
This is my preferred solution from the stackoverflow answers seen (mainly this one from Harlo Holmes). Any fragment that should pass data back to its containing activity should declare an interface to handle and pass the data. Then make sure … Continue reading
Posted in Android
Leave a comment
Pre-load database in app
To provide data in the apk in the form of a database it must be done in 2 stages: create your database and table and copy the file into the app write code in your app to copy that file into … Continue reading
Posted in Android
Leave a comment
Multi-line toast
To put toast message over more than one line: Toast.makeText(MainActivity.this, “Line1 : ” + string1 + “\n” + “Line 2: ” + string2, Toast.LENGTH_LONG).show();
Posted in Android
Leave a comment
Create new app in Eclipse as copy of another
Several responses found (eg stackoverflow), this method tried and tested. Open project, right click & copy. On main menu, Edit, Paste and give new name when prompted. Edit manifest, change package name(s) to new name(s) in all references in manifest. … Continue reading
Posted in Android
Leave a comment