Hi
I new to android development. Presently i am working on android project and i want to create a background thread which invokes the web service and get the data and insert in to array list. From foreground i need to fetch the data from array list and display in the list view.
I tried to create a background thread. but the problem is all code has execute finally my background thread start executing.
Can anybody have sample program for background thread or anybody give the sample idea for how to do the above concept?
Thanks
mindus
The strategy I like to use is to implement a message handler as part of the main activity (using the Handler() class), then send messages to the handler from the thread to update the activity based on thread events.
ASyncTask
The way i would do this is to use ASyncTask from the android sdk, google has a pretty good example in the developer documentation. The onPostExecute method runs on the UI thread when the thread has finished executing, so you could use this to tell your adapter that theres data to be put in the listview.
Sorry i can't post the link because im new here
Related
Hi guys
As part of an upgraded 'Touch Settings', I'll be automatically terminating some other processes (e.g. mediahubmini.exe) when the program runs.
I've been converting some c# code to do this (it P/Invokes toolhelp.dll) but unfortunately it's not working correctly and gives me odd PIDs that are too large to convert to an IntPtr.
Does anybody have a good example of any vb.net code to close a process by name? (please note there is NO window handle, so can't use SendMessage with WM_CLOSE as discussed in a previous thread)
Yours hopefully
Carlos
PS: full post (which nobody replied to) at: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2508309&SiteID=1
Try to use the FindWindowEx API call:
http://msdn2.microsoft.com/en-us/library/ms633500.aspx
One suggestion - why You did not compile original C# code to autonomn assembly, which will be referenced by Your VB.Net application?
So I've been reading a book and have a question about a setting that hasn't been covered. I search googler, but couldn't find anything that explained it.
Under Properties, you have Application name, Package name, and Create Activity.
Where can I find more info about this? (Activity class' that apply to droid and how to use them). I've been able to make the example activities but they don't use that field. So I'm a little lost as to what it is.
Thanks!
GhettoBSD said:
So I've been reading a book and have a question about a setting that hasn't been covered. I search googler, but couldn't find anything that explained it.
Under Properties, you have Application name, Package name, and Create Activity.
Where can I find more info about this? (Activity class' that apply to droid and how to use them). I've been able to make the example activities but they don't use that field. So I'm a little lost as to what it is.
Thanks!
Click to expand...
Click to collapse
Have you been to http://developer.android.com/index.html read up there iam sure it explains everything to get you started
Application Name
This is the human-readable title for your application — the name that will appear on the Android device.
Package Name
This is the package namespace (following the same rules as for packages in the Java programming language) that you want all your source code to reside under. This also sets the package name under which the stub Activity will be generated.
Your package name must be unique across all packages installed on the Android system; for this reason, it's important to use a standard domain-style package for your applications. The example above uses the "com.example" namespace, which is a namespace reserved for example documentation — when you develop your own applications, you should use a namespace that's appropriate to your organization or entity.
Create Activity
This is the name for the class stub that will be generated by the plugin. This will be a subclass of Android's Activity class. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an Activity is almost always used as the basis for an application.
I have been there, but I'd like more information.
Create Activity
This is the name for the class stub that will be generated by the plugin. This will be a subclass of Android's Activity class. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an Activity is almost always used as the basis for an application.
Click to expand...
Click to collapse
Trying to get more info as to which classes are available and what they're for in general.
Guess I'll keep reading my book "Beginning Android" lol
Thanks
I would like to share a simple tutorial that covers the Android Activity component.
Its not as basic as a 'HelloWorld', but it covers some simple but useful getting started like usecases such as:
* Activity component callbacks during launching an App and quitting an App
* App State persistence across re-starts
* Activity component callbacks for Menu creation and event handling
* Navigation from the main screen of the Activity to another screen within the Activity
The tutorial with source code is available at: openmobster.blogspot.com/2010/10/android-activity-basics.html
Since I am new to this community I was not allowed to post the link, so I had to use a workaround. I hope this is not considered spam.
My intention is to help the Android developer community learn more about the platform and also learn more myself from others in this community.
Thanks
Thanks for this! I always start learning a new environment using a 'getting started' book and online tutorials, and a tutorial like this, from the trenches as it were, is always a great place to get some tips and tricks!
-edit-
Uhm...your blog doesn't seem to exist?!?
I check it out, your link is fine & to above does work .
link
Jug6ernaut
The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
clonedaccnt said:
The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
Click to expand...
Click to collapse
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
any book suggestions?? im only studying at home and wanted to start studying android app development
m0nm0npalam0n said:
any book suggestions?? im only studying at home and wanted to start studying android app development
Click to expand...
Click to collapse
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Jonny said:
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Click to expand...
Click to collapse
thanks man! this really helps
Jonny said:
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
Click to expand...
Click to collapse
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example
Click to expand...
Click to collapse
clonedaccnt said:
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
Click to expand...
Click to collapse
When you get data from a server to an Android app you use php for the server code - for example you can use php/mysql to run a search for calendar events in the database and return those events. Then you need to use php's JSON encode function to send the data in a JSON array.
The output should look something like this - this is the output of the calendar database for my school:
http://wgsb.cobainschofield.com/android_db/get_calendar.php (note this is not the live schools site, its the test server the guy who maintains the live site allows me to mess with err use).
You would then use a JSON parser class and an AsyncTask from within the app to "download" the content of the JSON array and then display it in a listview or textview etc.
Now obviously to get this information requires an internet connection yes? So every time someone wanted to check for an event on the calendar or read a news article for example they would need a working internet connection to receive the output of the get_calendar script, this is inefficient and bad design as it does not allow for offline viewing of the data.
Therefore what you can do is use androids SQLite implementation to create a local sql database then the first time you need to get the data from the webserver, you connect to the internet and get the output of the php script, the using the JSON parser class you store the information in the sqlite database then get the information from the database to display to the user.
By this way users can view news articles or calendar events offline and you only need to connect to the internet to refresh the information
I've uploaded screenshots in the attachments of how I've done it for my school's app.
That made it clear! Thank you very much.
Hi Everyone,
I am currently a very new starter in the Android App Development stage. I have tried to develop a ListView with Searchbox facility to search data that comes from a specific URL in the form of JSON data. I managed to understand displaying this data in ListView, but adding a search facility is something I'm struggling to grasp somehow.
The code attached is a reference code I am trying to tune before I move on to actually developing my app. However, it doesn't seem to work on the emulator, giving me the error that the MainActivity file has stopped working.
I am unsure if there is a fundamental error somewhere, and would be really grateful to get some advice on this. I have looked online and can't seem to find a good resource that explains merging ListView with JSON data effectively with a Searchbox.
ajitmenezes said:
Hi Everyone,
I am currently a very new starter in the Android App Development stage. I have tried to develop a ListView with Searchbox facility to search data that comes from a specific URL in the form of JSON data. I managed to understand displaying this data in ListView, but adding a search facility is something I'm struggling to grasp somehow.
The code attached is a reference code I am trying to tune before I move on to actually developing my app. However, it doesn't seem to work on the emulator, giving me the error that the MainActivity file has stopped working.
I am unsure if there is a fundamental error somewhere, and would be really grateful to get some advice on this. I have looked online and can't seem to find a good resource that explains merging ListView with JSON data effectively with a Searchbox.
Click to expand...
Click to collapse
You should implement the search on the listview adapter, not on the activity itself.
Take a look at the following article:
http://www.mokasocial.com/2010/07/arrayadapte-filtering-and-you/