Android :: Way Of Loading Data / Notifying An Activity?
Oct 8, 2009
I just tried a stupid approach and it crashed my app... Basically I have an activity that has three tabs (containing three activities). Each of the tabs gets its input from an xml file downloaded off the net. Everything is fine but when I start my app, it has download the xml file and there's a "wait" time for this.I managed to get around this by adding a splash screen. It looks beautiful but the problem is when I click on the second tab, it still has to get the list off the net, so it looks ugly now... It waits before displaying the list. So what I did was design an AsyncTask that just downloads the xml file. In my main activity, I spawn two tasks initially and send the URL and Intent as parameters. And inside the activities that start inside the tabs, I use a wait(). Inside the AsyncTask, after it is done with the download, I notify the Intent using notify(). This crashed! Of course, I didn't expect it to work but just wanted to try :) Writing it so that I can either get a feedback as to why this failed or to prevent others from wasting their time on this...Now, I am sure many face the problem of a "wait" time inside the tabs. How do I solve this? I am thinking of either dimming the screen and then displaying a series of toasts or display a progress indicator inside the tabs or pre-fetching the xml files... I don't have a clue on how these can be achieved.
View 2 Replies
Feb 7, 2013
I'm pretty new to Android development and I just hit a brick wall in the development of an app, I'm currently working on.
The problem is that I have a list of locations (states), and when one is selected, a list of cities from that state is loaded via http request and JSON and then is supposed to be inserted into a listview in another activity.
So now I have the StateList activity and the CityList activity. Currently, the statelist activity starts the citylist activity via an intent and gives it a state name. Then, the citylist activity uses that name and requests data from a server via AsyncTask. As result I get an array of City objects, which are supposed to be inserted into an adapter for a listview.
Now begins my problem: I don't want the second activity to show up before all data is loaded. I also don't want the first activity to do the request and then have to transfer the whole result to the second activity using intent extras.
So what would I have to do now to have the second activity load all the data and only then really show up? I tried only setting the content view after receiving the data, but since the base class onCreate() is tied to some manipulation of the layout, I would also have to call onCreate() at that point, which is not allowed.
Here some code snippets of what I tried already:
The onCreate() method of my second activity (which is supposed to hide):
[high]protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
// send request for citylist data
CitylistRequest request = new CitylistRequest(this, new State(0, getIntent().getExtras().getString("state")));
request.execute();
[Code]...
View 2 Replies
View Related
Nov 13, 2009
I think I've missed something in how Android is supposed to work! I have the main Activity with a menu option that opens the preferences screen. What I need is a way for any changes that were made to be communicated back to the main Activity as soon as the preference is activated. At the moment the only way I could get it working is by using the intent data that gets sent back when the prefs activity closes but this isn't really enough. The reason why it needs to be instantaneous is that one of the preferences is a 'Clear cache' button, so I would like the data to be deleted when the user requests it and no later!
View 4 Replies
View Related
May 16, 2010
I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?
View 2 Replies
View Related
Mar 2, 2010
For my CS bachelors I am doing a Senior project using android and google maps.My vision was to do a (relatively) simple Dijkstra shortest path using google maps road data. I was going to add elevation change along with 2D distance. I am doing well playing with maps in android but I am completely stumped trying to access google maps data in any sort of searchable form.How would I go about accessing the data for say intersections of roads (lat/long) in a particular area?There has to be a way to pull that data in some sort of tree form. It seems like it may be possible with kml?Any pointers would be awesome.I want my paths to follow roads but If i cant this is going to turn into an orienteering application fairly fast.
View 2 Replies
View Related
Jun 23, 2010
to start with I've gone through the entire notepad tutorial, I'm a professional game programmer who has some extra time. (though most of my time has been in C++, I did take a year or two of Java classes in college, and remember some of it). I'm not sure the site is a good site to ask questions like this.. If someone has a Forum that might be a good place to ask these newbie questions, please feel free to point me in the direction. I've examined a few of the samples, and think I've a grasp of what I want to do. I've a three to four project plan for some Android releases to sharpen my skills, but since this is my first project and I have never really developed for a mobile phone or the android before, I'd like to make sure I have a solid plan.The first project is an example of the license plate game, however I want to do a few things to change it. Heck maybe when I'm done it'll become a bingo style game, with bluetooth connectivity, you never know. The base idea is I want to offer a list of states, with checkboxes next to them. so to do this, I'll be starting with a Linear List layout similar to the note pad example, and then have a row that is only a Checkbox. I can use text and call strike through if it's been checked off. Perhaps offer an option to not show them if they are checked.
But I want the list to be generated from a set of lists. Maybe all of America's states, maybe reasonable American states (no Hawaii, no Alaska) maybe a North American list, (add in Mexico and some Canadian provinces), a European list, who knows. I'd probably have to have a pop up window that lists all of the lists I suppose using a radiogroup of some sort. So then as far as the data, after weighing options I think best solution is to make a database with two fields, "checked" and "name".I figure I can use the menu for most of the user interaction (aside from clicking on stuff we want to check off) with maybe a few context menu items, I understand how to make all of those already so I should be good. The question I have is what is the best way to populate the lists? Should I create raw data, and have different files for all the lists? Or is there some other way to do this? I've seen this done on the searchable dictionary, but I'd like to hear what people who have actually generated the data like this before. In addition is there an easy way to look at the sql database these applications create, or do you have to run searches on them and output the data? Finally any other suggestion or advice? I definitely want to try to get something like this on the market so I can see the full life cycle and see if anyone actually likes it. (luckily there's not a plethora of them already) but I also want a few people to look over my code if they're willing when I'm done to make sure I've done this right or at least not missing any basic mistakes.
View 2 Replies
View Related
Nov 2, 2009
I've looked through the documentation and I can't seem to figure out how to have the screen blured/greyed when I select an activity that may take a while to load.
This seems to be an Android standard (both the Camera app and the Camcorder app do it when first selected), but I don't see any documentation on it. I even tried looking through the source of these apps on git, but couldn't seem to find it.
View 3 Replies
View Related
Apr 29, 2010
How can we use more than one layout file. I have implemented a cutom dialog.That means i have created an layout file for dialog. And one layout file for my activity. But whatever the UI items in dialog layout ile if iam using them by findViewById it is giving me null
I will explain in details here @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); applicationContext=getApplicationContext();
Dialog folder=new Dialog(this); folder.setTitle("Creating folder"); folder.setContentView(R.layout.create_folder); TextView tv=findViewById(R.id.folder_text); //Here folder_text is in my second layoutfile ie in create_folder.xml //In the above statemet i got the null to tv variable. folder.show();
View 5 Replies
View Related
Oct 25, 2010
In my android application i am trying to download images from remote server dynamically ( no of images dynamically come ). for downloading all images it is taking 30 to 40 seconds mean time user has to wait to see the activity . But it is the worst case that loading activity after loading all images. I want to load activity first then load images one by one.
View 3 Replies
View Related
Jul 1, 2010
Im trying to show a ProgressDialog while the activity is loading. my problem is that although i completed all the work in the activity. it takes a long time for the activity to load, i suspect this is because i use
multiple views with multiple listviews with custom array adapters inside a viewflipper. it takes a long time for the UI to show.how would i go about checking that all the UI inside the activity finished loading? or is there a way to preload all the activity and the UI?
View 2 Replies
View Related
Mar 24, 2010
This may be a simple question but i am a beginner ,i need your suggestion on this. i have two Activities A1 and A2 .When i click the image on A1 screen i have to display progress bar until A2 screen appears(A2 activity has huge task to do).
I tried:
CODE:...............
This couldn't display progress bar .I know that i am making a mistake but i couldn't figure out.
View 1 Replies
View Related
Jan 1, 2010
I'm trying to load the parsed HTML data from an rss feed using a WebView, but the webview claims...
View 3 Replies
View Related
Jun 20, 2010
I've been staring at this for hours. It compiles fine with no errors and loads the activity on my nexus. The button and the menu items load fine with no issues at all. It's simply not loading any of the drawables i'm specifying :/ any ideas what I did wrong?
All I want is whenever this activity is brought up it randomly chooses an image from the drawables i specify.
CODE:...........................
View 6 Replies
View Related
Apr 10, 2009
I have a message application so that on view 1 is displayed a list of messages and when you go to view 2 (subactivity) you can send a message. I want the program to work so that when you hit the android back button, you can go back to view 1 and see the list of messages including the new message. Right now only the old data is displayed, and I noticed that displayContent() is not called when going back which I assumed it would. Is there any way to specify that when the back button is hit, to call displayContent() again on the previous activity?
View 3 Replies
View Related
Aug 1, 2010
I have got list that is filled with data from internet.
Datas are downloaded in chunks. At the end of the list next portion of data is downloaded and added to the list.
I'm detecting list end with help of onScrollListner:
CODE:........
I would like to addLoading... row when datas are being downloaded. Something similar to Gmail loading row at the end of the list.
I know that I can hack adapter.getCount() to return size + 1 and force adapter.getView to display loading... at the end of the list.
How can I do that in more elegant way?
View 1 Replies
View Related
Jan 20, 2009
My application needs to load and process some data at the startup which delays the displaying of the GUI quite a bit. I addressed that problem by starting a new thread to load and process the data. It solves the problem nicely, but is there a better way to do asynchronous processing in Android applications that I missed?
View 2 Replies
View Related
Dec 1, 2009
I just purchased my Driod on Wednesday. I took it back today because it kept on freezing. They gave me a new one, but for the last 6 hours it has been "loading data, Please wait...". The Verizon store had no clue what was going on. It is in the task bar.
View 4 Replies
View Related
Sep 29, 2010
I have multiple ListActivity(s) with a custom ArrayAdapter. I have to load an XML file from the Web, and the user moves to a new activity by selecting a list item.
What is best practice for:
Displaying a loading indication to the user.
Threading the networking stuff so that the user can cancel the loading of the data if need be / move to the previous activity.
Example/source code would be greatly appreciated - I've used http://www.helloandroid.com/tutorials/newsdroid-rss-reader as an introduction, however it doesn't display a loading indication.
View 1 Replies
View Related
Dec 30, 2009
I am developing an application in which the user require to register first and than got the user page. For that i have made layout and the layout consist many fields, so, i have made part of layout and also made the separate activity for the each layout. The layout like address, phone, etc... After that i have wrote the code for calling an activity and it works fine. It means when i press the "Next" button the another page will come and it will also consist some textview ,edittext and previous and next button. Actually, i want something different like -- When the user fill the first form and he will proceed to next, the content written by the user should not gone when the user press "Next" button. The content should be there which was written by user. And same way i have have 6 pages like that way to complete the registration process. So, have you any idea to solve above problem? I really need your help because right now i stuck at this point. So, please any body help me out of this problem. I would appreciate your help. I am waiting for your reply.
View 15 Replies
View Related
May 27, 2009
when I load external web page, image or javascript file from local webpage. I can't see external image and can't load javascript or webpage. But I can only see local image. Why I can't load external javascript, webpage or image? Here is the HTML source. (of course, I filled right [daum open API key])
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta
http-equiv ="Content-Type" content="text/html;
charset=UTF-8"> <title>Daum 지도 API</title>
<script type="text/javascript"
src="http://apis.daum.net/maps/maps.js?
apikey=[daum open API key]" charset="utf-8"></script> </head> <body>
<div id="map" style="width:600px;
height:400px;
" style="border:1px solid #000">
</div> <img src="http://4.bp.blogspot.com/_2-7AdSkZA7I/RlCnDhD3ZfI/ AAAAAAAAE9U/LEHMtyVLdY8/s400/CutyTale10.jpg">
<img src="file:///android_asset/coffeebean.jpg">
<script type="text/javascript">
var map = new DMap("map", {point:new DLatLng(37.48879895934866, 127.03130020103005), level:2} );
</script> <iframe src="http://www.daum.com" width="300" height="150"></iframe> </body> </html>
and I use this Activity source
package bo.my.android.test;
import android.app.Activity;
import android.os.Bundle; import android.webkit.WebView;
public class OpenAPITest extends Activity {
WebView webView;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(new DaumMapClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/daummap.html");
//webView.loadUrl("http://www.daum.net");
} }
View 3 Replies
View Related
Jun 12, 2010
I have got an htc hero device and would like to install my apk on it. It successfully installs my apk but without the database it is using. My database is populated prior to running the application, so it runs ok on the emulator. But I couldn't load my data on the real device and the apk is displaying forse close error. How to load my data on the data folder of the device including every detailed steps?
View 2 Replies
View Related
Oct 7, 2010
I just received a warranty exchange Samsung Vibrant, & I am currently in the process of putting all my apps onto it. I have the widget on my home screen. The widget seems to be working, but the "loading data please wait" message is still displayed in my notification drawer & the little circle of dots is still in the task bar up top.
View 1 Replies
View Related
Mar 4, 2010
Does anybody have an example of lazy loading (about 10,000 items) an Android ListView from a Sqlite databse?
View 1 Replies
View Related
Nov 25, 2009
I have a message -- saying Loading Data, please wait -- but it's been a long time. What does this mean? How can I make it stop?
View 8 Replies
View Related
Jan 4, 2013
I download apps from play store, amazon appstore and other places..
When I restart my phone, Some apps (no matter where are they from (play, amazon, etc.)) They stop working.. they dont work anymore.. and I will have to re install the apps again and loss all data
And also some apps that still work, they start like its the first time I am starting them and all data in them are lost..
I tried multiple things to fix this like I factory reset my phone and also tried to flash new version of stock rom but I still have this problem.
My device: Galaxy Note 2, jelly bean 4.1.2, rooted (no custom rom indtslled)
View 3 Replies
View Related
Feb 7, 2010
I'm trying to generate a notification which vibrates the phone and plays a sound when the screen is off (cpu turned off). According to the Log messages, the notification is being sent, but the phone doesn't vibrate or play the sound until I turn the screen on again. I tried holding a 2 second temporary wakelock (PowerManager.PARTIAL_WAKE_LOCK), which I thought would be ample time for the notification to be played, but alas, it still doesn't.
Any pointers to get the notification to run reliably? I'm testing this on an G1 running Android 1.6.
Code I'm using:
CODE:.................
View 1 Replies
View Related
Sep 17, 2010
I have a situation here where i have an intent A that calls intent B. In Android 2.x, the application B consistently crashes the dawvik virtual machine when it runs the second time. Then, if A calls B again, it works.
Is there a way to let A find out that the vm has crashed? This way, i could just redo intent B.
View 3 Replies
View Related
May 4, 2009
I want to display a fancy 'loading' image at my app's startup time.
The problem: my startup code is mostly GUI related, hence needs to run on UI thread.
Is there a way to do both - that is run UI-related code on UI thread while an image is displayed to the user?
View 8 Replies
View Related
Dec 12, 2009
I have a ListView that has some minor visual preferences that are set in a PreferenceScreen. These preferences are simple booleans to show or not to show some specific TextViews on each item in my ListView.
Anyhow, when these preferences are changed, I need to notify my ArrayAdapter that the data has changed in order to get the list redrawn. However, doing this via an OnSharedPreferenceChangeListener wouldn't really be optimal because there are several preferences that you can change, that would cause an unnecessary amount of updates to the ArrayAdapter.
So, to the question: How can I identify when my ListActivity has occurred on the screen after closing my PreferenceActivity, which I then could use to check for changes in the preferences, and only then notify the ArrayAdapter.
The ArrayAdapter being an inner class of my ListActivity, which is set as a ListAdapter.
View 1 Replies
View Related
Nov 19, 2010
I have 2 gmail (apps) accounts on my phone.The first account: I want to know when I get an email.The second account: I don't want to know when I get an email - but still want, for checking and sending only when I look at the account.Is it possible to disable notification on one account and keep the other?I've got a Sony Xperia X10 Mini Pro and have waited a looooong time to get 2.1, JUST for the multi email accounts capability - now that I've got it, I'm not liking it because I get disturbed when I get email on the second account.
View 6 Replies
View Related