lundi 3 mars 2014

Splash screen with background task


Vote count:

0




I have a splash screen that loads URLs from the Internal Storage and downloads their content from the Web (with an AsynkTask). It puts the downloaded data into an ArrayList, calls the main Activity and finishes. The main activity adapter manages the ArrayList and sets a ListView containing its data.

While I'm in the main Activity, if I press the back button the application exits (I set the android:nohistory="true" for the splash screen activity), but when I return to the app, the splash screen gets loaded and downloads the data again, "doubling" the list view.

How can I prevent the splash screen to be loaded when I return to the app?


Splash screen code:



Context mContext;
ProgressBar progress = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
setContentView(R.layout.activity_launcher);

progress = (ProgressBar)findViewById(R.id.progress);
progress.setIndeterminate(true);


if(canWriteOnExternalStorage()) {

try {
setupStorage();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
//dialog appears


}


The setupStorage() method loads the file from the Storage and executes the AsynkTask.

Maybe could the overriding of the onRestart() method be a solution?

Or should I prevent the AsyncTask from loading the data already downloaded?

Thanks!



asked 1 min ago






How to combine local and Facebook users in iOS app


Vote count:

0




I want to give the opportunity for a user of an app to register/login with Facebook or by creating an account. I know that I can get the user's Facebook account email address, and their first and last names. That's basically the only information for creating a 'local' app account, apart from a password. How can I make sure that if that person logs in to Facebook on another device, that their two devices are linked to the same 'local' account? (i.e if they choose to sign in with Facebook with 2 devices, I only want one local account to be created on my server for that user).


Ideally, I want the login schemes for both to be identical. So if that user logs in with Facebook, I can check (securely) that the FB account is linked to a 'local' account, and automatically log that device in without making the user type in a password. Is this possible?


Edit: The 'local' users will be stored in a database on my server, and the front end will be done in Python running alongside the API for the app. Note that 'local' is just referring to the fact that it uses my app web service rather than an external social network.



asked 1 min ago






is it possible to append google map to DOM after a specific event has fired?


Vote count:

0




When I put google map script in of my page, it makes my page to load slower , and sometimes with some error(not important) By script I mean this :



<script type=text/javascript src='http://ift.tt/1ljOcT5? key=&sensor='></script>


Now , is it possible that I do something like this:



1- A modal shows
2- $('script#befor_map').after("<script src='http://ift.tt/1dsQ3T1'></script>");
3- google.maps.event.addDomListener(window, 'load', initialize());


First a modal's fires


after that , I append google_map script after an existing script(called "befor_map)


and after appending , I initialize the map


everything seems correct , but I get an error in my console:


*Uncaught ReferenceError: google is not defined *


and map doesn't run


whats the problem ?


everything works fine , if I put map script on my the head of the page withoud any method



asked 1 min ago






how to git add -up changes from only specific files


Vote count:

0




For adding changes to index from working directory, I use git add -up.


Now I want git add -up to only show changes from specific files. How to do that?


Or Rather ignore few specific files and show changes from all others?


Note: I dont want to add the specific files to gitignore list, I just want to ignore them certain times as they contain settings for debugging which I dont want to commit



asked 22 secs ago






is there an inside-Eclipse continuous-integration tool for javascript that looks like infinitest?


Vote count:

0




When I program in Java, I have recently discovered the free unit-testing tool Infinitest, and installed it as an Eclipse Plugin. The GUI is minimalistic and looks like this statusbar at bottom of picture:


screenshot infinitest


(The bar is green when all tests pass, and it is red if tests fail.)


Is there a similar tool that inserts a status bar into Eclipse like this, but works for unit tests written in Javascript?


I would also be interested in solutions that work for any other language but can be adapted for javascript. And the test runner does not necessarily have to be an eclipse plugin. I'm interested in having seamless workflow with instant feedback from the test runner (just as in Infinitest). Whenever I save a script file, the testrunner gets triggered.



asked 24 secs ago

knb

2,278





How to know whether a running application has exited and based on that do something in C?


Vote count:

0




How do i know that a process [not called by c] has exited and based on that do something in C?


For eg. there is a running application , say notepad. I create an application to delete the text file created by it. I cannot do that while it is open . So how do I know when notepad exits and based on that take a decision in C.,.,



asked 36 secs ago






samedi 1 mars 2014

Question about OculusVR HMD

Does anyone know if this HMD works with a standard HDMI feed? Or does it need drivers etc? I want to order one of these for FPV in my RC aircraft. Also what are the specs of the display tech? Is it LCD or OLED. I was looking at the ZEISS Cinemizer but that thing îs double the cost of the Oculus...:roll: