Need some help with app I'm making - Java for Android App Development

I'm making an app for my church and a few surrounding churches. I want to use one app for all of them. I want the user to be able to open the app, go to setting. Then in the setting I have 2 spinners. One or cities and spinner 2 for churches. Once the church is selected the user is then taken to that churches page. I want that page to now be set as the main screen seen when opening the app every time. I want each user to be able to select their own church as the main screen when opening the app. I don't know how to set that tho. Can someone help me? Is there a better way to accomplish this than what I'm doing? I also want to be able to go into settings and allow user to visit other church pages. I was thinking he way I'm going and having 2 buttons. One for setting as home and one for visiting. Like I said tho. I can't figure out how to set it as the new main activity like I want to do.
Sent from my LG-LS995 using XDA Free mobile app

jeb192004 said:
I'm making an app for my church and a few surrounding churches. I want to use one app for all of them. I want the user to be able to open the app, go to setting. Then in the setting I have 2 spinners. One or cities and spinner 2 for churches. Once the church is selected the user is then taken to that churches page. I want that page to now be set as the main screen seen when opening the app every time. I want each user to be able to select their own church as the main screen when opening the app. I don't know how to set that tho. Can someone help me? Is there a better way to accomplish this than what I'm doing? I also want to be able to go into settings and allow user to visit other church pages. I was thinking he way I'm going and having 2 buttons. One for setting as home and one for visiting. Like I said tho. I can't figure out how to set it as the new main activity like I want to do.
Sent from my LG-LS995 using XDA Free mobile app
Click to expand...
Click to collapse
I'm assuming you've tried using an if statement inside your spinner declaration?

My approach would be the following:
Make a settings activity for your app, details on how to do this and also how to create the xml menu resource, can be found here: http://developer.android.com/guide/topics/ui/settings.html
Concerning the selection of church and city, you should have a look at the ListPreference item mentioned in the guide.
When this is done, and the user has selected something inside the settings, this value is automatucally saved in a dedicated settings sharedprefs file. Now in your onCreate of the main activity you should do this:
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); //this lets you get access to the settings sharedprefs
Then do this:
String church = pref.getString(KEY_FOR_CHURCH_VALUE, "");
if (church.contentEquals("")) startActivity(this, SettingsActivity.class) //if there is no saved value for the church, automatically open the settings
if (church == "foo1") {
//do something, for example setContentView(R.layout.foo1_layout)
}
... And so on
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

Masrepus said:
My approach would be the following:
Make a settings activity for your app, details on how to do this and also how to create the xml menu resource, can be found here: http://developer.android.com/guide/topics/ui/settings.html
Concerning the selection of church and city, you should have a look at the ListPreference item mentioned in the guide.
When this is done, and the user has selected something inside the settings, this value is automatucally saved in a dedicated settings sharedprefs file. Now in your onCreate of the main activity you should do this:
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); //this lets you get access to the settings sharedprefs
Then do this:
String church = pref.getString(KEY_FOR_CHURCH_VALUE, "");
if (church.contentEquals("")) startActivity(this, SettingsActivity.class) //if there is no saved value for the church, automatically open the settings
if (church == "foo1") {
//do something, for example setContentView(R.layout.foo1_layout)
}
... And so on
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Click to expand...
Click to collapse
Thanks. I'll try to give that a try sometime this week if I get time.
Also, what would be the best way to update textviews on a monthly basis. I'll prob have a quite a few of them that get updated every month. I'm thinking of putting txt files into the assets folder and and then each month I just replace them with a new update txt file. but searching google I'm seeing mixed responses on doing this. Is it possible to link a folder in my app with dropbox or drive so I can replace the old txt file on there and see the results in my app? I'm thinking this would be better than pushing an update every month...

jeb192004 said:
I'm making an app for my church and a few surrounding churches. I want to use one app for all of them. I want the user to be able to open the app, go to setting. Then in the setting I have 2 spinners. One or cities and spinner 2 for churches. Once the church is selected the user is then taken to that churches page. I want that page to now be set as the main screen seen when opening the app every time. I want each user to be able to select their own church as the main screen when opening the app. I don't know how to set that tho. Can someone help me? Is there a better way to accomplish this than what I'm doing? I also want to be able to go into settings and allow user to visit other church pages. I was thinking he way I'm going and having 2 buttons. One for setting as home and one for visiting. Like I said tho. I can't figure out how to set it as the new main activity like I want to do.
Sent from my LG-LS995 using XDA Free mobile app
Click to expand...
Click to collapse
Masrepus had a good solution.
You may also want to consider the following:
Make a new XML file with 2 (or more) spinners, that give you the desired options. Using a dialog box, you can load this XML file and dynamically fill the option list. In this way, the app can see what pages you have made and provide them as options to the user automatically.
If you like, you can save the last user selection (e.g. to file) and give that as a starting value.
I suggest using 2 buttons (also part of the same XML) form where the user can cancel or apply his selection. Using an OnListerner event, you can detect the user choice and perform the appropriate action.
The actual pages can be created as a seperate activity (intent) or can be loaded dynamically into the main window.
Hope this helps.

I've finally gotten a chance to start working on this again. I got my spinners to work. Adding different list to sp2 based on what is selected in sp1. But I like the idea of using pref list. Can I do this with pref list. Can I add different lists to my second pref list like I do with the spinners?
Sent from my LG-LS995 using XDA Free mobile app

Android Application Development Request
I am in need of some help I have a great idea for a new app that may change the face of advanced research. This will allow for the user to search all day and all night. While they are handling everyday life issues and events with family and what not. Yet still, allowing them to locate what they are looking for. Also will allow people with artifacts in there home. That the user may think is not worth anything yet it may be a goldmine. So instead of the user having to do research trying to locate these specific artifacts to see if they are worth money. This app will allow them to do advanced research all day with a touch of a button my idea is revolutionary when it comes to the advanced research that needs to be done. Please, I am looking for somebody to help me develop this app and bring it to life. So that I may present this idea to google for a possible sale. Thank you for your consideration ahead of time on helping me with this application.

Related

TabHost recreating instances

I'm developing a simple android application using the TabActivity.
This Activity adds 3 tabs, each one with its own activity.
The problem is: when I tap each tab, the system calls onDestroy of the current activity. So, when I tap the first activity again, all the state of private fields are gone, its like it has created a new instance every time I change tabs.
I was searching around about this, and looking on the samples, but I guess that the default behavior is to keep the activity instances paused when the tab is not current.
Anyone have an idea of what I'm missing?
Thanks.
That is by design. You need to override onSaveInstanceState() and onRestoreInstanceState() in your activity class. You can store/retrieve state data there, or retrieve it int the Bundle passed into OnCreate(). See:
http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)

[Q] Help with Gallery App

I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
StEVO_M said:
I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
Click to expand...
Click to collapse
I had a look at the source and from my understanding the important class here is that DataManager class here. Especially the getTopSetPath() with the static final Strings and maybe the mapMediaItems() methods seem to be where you need to look at. You might have to play around a bit, but this is where I would start.
SimplicityApks said:
I had a look at the source and from my understanding the important class here is that DataManager class here. Especially the getTopSetPath() with the static final Strings and maybe the mapMediaItems() methods seem to be where you need to look at. You might have to play around a bit, but this is where I would start.
Click to expand...
Click to collapse
I have tried adding/changing the following
Added...
//Setting Folder Path
public static final String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
Changed...
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = targetPath;
private static final String TOP_IMAGE_SET_PATH = "/combo/{/mtp,/local/image,/picasa/image}";
private static final String TOP_VIDEO_SET_PATH = "/combo/{/local/video,/picasa/video}";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I even tried setting all of the _PATH s to my targetPath
And I get a NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): Caused by: java.lang.NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): at com.myprivgallery.common.Utils.checkNotNull(Utils.java:48)
Which leads me to this in Utils.java
line 46 // Throws NullPointerException if the input is null.
line 47 public static <T> T checkNotNull(T object) {
line 48 if (object == null) throw new NullPointerException();
line 49 return object;
line 50 }
So if I am reading correctly, it is saying the path is empty. But I know that path works in other apps and it is not empty.
StEVO_M said:
I have tried adding/changing the following
Added...
//Setting Folder Path
public static final String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
Changed...
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = targetPath;
private static final String TOP_IMAGE_SET_PATH = "/combo/{/mtp,/local/image,/picasa/image}";
private static final String TOP_VIDEO_SET_PATH = "/combo/{/local/video,/picasa/video}";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I even tried setting all of the _PATH s to my targetPath
And I get a NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): Caused by: java.lang.NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): at com.myprivgallery.common.Utils.checkNotNull(Utils.java:48)
Which leads me to this in Utils.java
line 46 // Throws NullPointerException if the input is null.
line 47 public static <T> T checkNotNull(T object) {
line 48 if (object == null) throw new NullPointerException();
line 49 return object;
line 50 }
So if I am reading correctly, it is saying the path is empty. But I know that path works in other apps and it is not empty.
Click to expand...
Click to collapse
I don't think you can call an Environment method when static class variables are Initialised make sure that your String is the correct path with Logs, I would probably make that an instance variable instead...
SimplicityApks said:
I don't think you can call an Environment method when static class variables are Initialised make sure that your String is the correct path with Logs, I would probably make that an instance variable instead...
Click to expand...
Click to collapse
It may kinda look like I know what I'm doing, but looks are deceiving.
I really have no clue what I am doing. I consider myself a hack. I can some what look at code and then make it do what I want, but to actually program something new... I will see if I can't figure that out. But I really do appreciate your help.
StEVO_M said:
It may kinda look like I know what I'm doing, but looks are deceiving.
I really have no clue what I am doing. I consider myself a hack. I can some what look at code and then make it do what I want, but to actually program something new... I will see if I can't figure that out. But I really do appreciate your help.
Click to expand...
Click to collapse
Well then you should probably get started on a simpler app you've built yourself rather than trying to understand this very complex Gallery app (which in my view is poorly commented and documented)...
I had a closer look at the source and it seems that we are on the right track because the _PATH s are used in the getTopSetPath method of the DataManager, and a search reveals that it is called by various activities and pickers. If you're using one of those in your app we should be right.
Now let's get back to the basics, when the app is launched, the default launcher activity is Gallery.java. During it's creation, either startDefaultPage, startGetContent or startViewAction is called, but all of them have the following call:
Code:
data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(DataManager.INCLUDE_ALL)); // or some other variable
So this is the path where the images are loaded. Honestly, I have no idea what the
Code:
"/combo/{/mtp,/local/all,/picasa/all}"
is doing in the path variable, it has to do something with the Combo classes in the data folder, since the app is loading images from different dirs. You can now call your Environment call there and somehow pass back Strings instead of Paths, but it would be nicer if we could somehow figure out the these Paths are used here. An important class is the LocalPhotoSource.java. That is also where getImage from the DataManager is called. You could have a look at that class as well. Which path do you want the gallery to scan actually? The best solution would be to further experiment with the _PATH String, without calling Environment as well as debugging the whole app from the start, so you can get an idea of how everything is working.
SimplicityApks said:
Well then you should probably get started on a simpler app you've built yourself rather than trying to understand this very complex Gallery app (which in my view is poorly commented and documented)...
I had a closer look at the source and it seems that we are on the right track because the _PATH s are used in the getTopSetPath method of the DataManager, and a search reveals that it is called by various activities and pickers. If you're using one of those in your app we should be right.
Now let's get back to the basics, when the app is launched, the default launcher activity is Gallery.java. During it's creation, either startDefaultPage, startGetContent or startViewAction is called, but all of them have the following call:
Code:
data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(DataManager.INCLUDE_ALL)); // or some other variable
So this is the path where the images are loaded. Honestly, I have no idea what the
Code:
"/combo/{/mtp,/local/all,/picasa/all}"
is doing in the path variable, it has to do something with the Combo classes in the data folder, since the app is loading images from different dirs. You can now call your Environment call there and somehow pass back Strings instead of Paths, but it would be nicer if we could somehow figure out the these Paths are used here. An important class is the LocalPhotoSource.java. That is also where getImage from the DataManager is called. You could have a look at that class as well. Which path do you want the gallery to scan actually? The best solution would be to further experiment with the _PATH String, without calling Environment as well as debugging the whole app from the start, so you can get an idea of how everything is working.
Click to expand...
Click to collapse
I tried Changing the following in LocalAlbumSet.java
public class LocalAlbumSet extends MediaSet {
public static final Path PATH_ALL = Path.fromString("/DCIM/_private/.nomedia/all");
public static final Path PATH_IMAGE = Path.fromString("/DCIM/_private/.nomedia/image");
public static final Path PATH_VIDEO = Path.fromString("/DCIM/_private/.nomedia/video");
and Changing all of the TOP_..._Path s to
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = "/local/all";
private static final String TOP_IMAGE_SET_PATH = "/local/image";
private static final String TOP_VIDEO_SET_PATH = "/local/video";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I now see Random Images from /DCIM/_private/.nomedia but not all of them, which is really confusing. But at least it's a start.
StEVO_M said:
I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
Click to expand...
Click to collapse
Android gallery will not scan any folder having a .nomedia file in it.
EatHeat said:
Android gallery will not scan any folder having a .nomedia file in it.
Click to expand...
Click to collapse
So I am guessing there is no way to Force your own instance to scan it????
StEVO_M said:
So I am guessing there is no way to Force your own instance to scan it????
Click to expand...
Click to collapse
Delete the .nomedia file.
Lol. Not an option if I want to hide my pic.
Sent from my HTCONE using Tapatalk
Not sure what you are trying to achieve, if you want to scan it then why would you want to hide it?
If you want to add an option to allow it to scan or not, you could backup the .nomedia to another directory and delete it for the time being.
Just an idea, can't say for sure. Didn't try it ever.
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Sent from my HTCONE using Tapatalk
StEVO_M said:
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Click to expand...
Click to collapse
Well why do you need to? Make your app fulfill only one purpose, so let it hide the pictures (I guess by moving a .nomedia file into the folder right?) and then just create a shortcut in your app to the gallery app so the user can still use their preferred one... Makes more sense to me and is way less work.
StEVO_M said:
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Sent from my HTCONE using Tapatalk
Click to expand...
Click to collapse
A far more simple and logical way would be to create a hidden folder on the SD card with a .nomedia file in it. Images/videos that are to be hidden can be moved to that location. This would keep it hidden from the gallery and can only be accessed through your private gallery.
For unhiding media, just move them back to their original folders.
Let me try to explain further... As I said, I have created an app already that does the Basic things.
My Application looks like a standard App, a "To Do List", but if you press and hold an Icon on the main screen it prompts you for a Password (These passwords are setup on first use).
Now... Depending on which password you enter, it will either take you to the hidden Gallery OR if you enter a different password it will take you to a Hidden To Do List. This is so anyone that may stumble upon your app, you can show them that it's has a hidden area of the app. This way they have no clue you really have a Hidden Gallery.
If you enter the Hidden Gallery password then it would of course, take you to the hidden gallery.
The Current Features are...
Import from Main Gallery
Pinch to Zoom
Swipe
Share
Restore back to Main Gallery
Delete
Quick Escape ------ "Quick Escape" can be activate 2 ways. If you shake the phone while in the Hidden Gallery, the image will change to an image of your choosing or the default one that is set during install. OR..... A less obvious "Quick Escape" ... While in the Hidden Gallery, press the volume up or down and the image will switch. Either way, once it is in that mode, you can not press back. the only way out it to press the home button. This is designed so if someone grabs the phone out of your hand they will only see they Quick Escape" image and pressing back will not take them back to the gallery.
My app also appears in the standard Share menu, so if you are in your Main Gallery and want to hide a picture, you can share it to my app and it will then hide the picture.
I want to add More features to my Gallery, such as Filters, Editing (crop, rotate...), Frames... All the same things that you can do in the Main Gallery. The only thing I really don't want or need is a Camera function. I can't see someone taking the time to open my app and then get to the Hidden Gallery and then taking a picture, just so they can hide an image. Most would just take the picture as they always would and then "Share" it to my app.
I hope this explains Why I want to use the other Gallery rather than reinventing the wheel that already has all of these features built in. If I can not get that to work, maybe I can just pull the Features out and use those.
Anyone who wants to actually See the app in action, PM me and I will send you a DropBox link to install. FYI, It requires 4.0 or higher.

How can I let my user create a shortcut to an app, into my app (like a launcher)?

I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.
I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.
How would I go about doing this?
nex7er said:
I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.
I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.
How would I go about doing this?
Click to expand...
Click to collapse
To get a list of all installed applications, use
Code:
final PackageManager pm = getPackageManager(); //get a list of installed apps.
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
To start them just create a new Intent(packageName) and start it with startActivity(intent);
SimplicityApks said:
To get a list of all installed applications, use
Code:
final PackageManager pm = getPackageManager(); //get a list of installed apps.
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
To start them just create a new Intent(packageName) and start it with startActivity(intent);
Click to expand...
Click to collapse
Hey, thanks for the quick reply! That works wonders! Half way already. Thanks a lot.
Now how would I go about having it so that the apps I select in the list of apps stay selected, then upon an onClick of a button they get returned to my fragment (activity)? And to have them saved after that, would I need to read up on sqlite?

A paragraph about Intent concept

Hi
In the book that I am reading there is a paragraph about teaching the Intent concept :
"" An intent generically defines an intention to do some work. Intents encapsulate several
concepts, so the best approach to understanding them is to see examples of their use.
You can use intents to perform the following tasks:
Broadcast a message.
Start a service.
Launch an activity.
Display a web page or a list of contacts.
Dial a phone number or answer a phone call.
Intents are not always initiated by your application—they’re also used by the system to
notify your application of specific events (such as the arrival of a text message).
Intents can be explicit or implicit. If you simply say that you want to display a URL, the
system decides what component will fulfill the intention. You can also provide specific
information about what should handle the intention. Intents loosely couple the action
and action handler. ""
I completely understand the paragraph except the final portion that I underlined it .
What does that mean ???
Please explain it for me .
What is action and action handler ???
Thanks for your help
The action is what you want to do (e.g.: show a website) and the action handler is the app that can handle the action (e.g: the browser app).
So a intent combines that two things: the information "show a website" and the app that can do what you want (the browser)
@EmptinessFiller is right .
Suppose you want to open an image generated by your app. Then you would have the following options:-
Option 1
Implement a custom Activity and send an intent to start it so the image can be processed.
Option 2
Launch an intent to any other app like the gallery app to handle the intent.(Display your image)
Give a thanks if you think this post helped you!
Sent from my Nexus 4 using XDA Premium 4 mobile app
The 'loosely' in my opinion refers to the possibility to either exactly define who you want to do your action (an explicit intent) but you can as well just leave open who does that (an implicit intent), then you will get that well known 'complete action using...' dialogue
So action and its handler can but dont have to be coupled inside the intent
---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------
Gesendet von Tapatalk

[Q] How To: Randomize a list??

Dear Friends,
I'm working on an application which has a list of 5 items connected to a database at the back end. I would like to know how can I randomize the order of appearance of these 5 items in these list every time the app start?
Ex
Item 1: A
Item 2: B
Item 3: C
Item 4: D
Item 5: E
Next time the app launches the order of appearance is at random.
Ex
Item 1: C
Item 2: E
Item 3: A
Item 4: D
Item 5: B
So, on and so forth for every instances of app launch.
Also, how can I add transition animation (fade in, fade out, slide in, etc) like most of the modern web-pages have for the app UI. I do not have much programming experience. Just a learner. All help will be appreciated.
Look on the animations tutorial at androidhive.info ( i think it's proper address ).
Answering the first question, I would write method for database that returns list of items and implement randomization in it. Then just create instance of database in onCreate and make just like this : List<Item> randomList = db.returnRandomList();
I think this would be the easiest and most explanatory way that you could understand for the random list
Code:
private ArrayList<String> random(ArrayList<String> list)
{
ArrayList<String> randomList = new ArrayList<String>();
while(list.size() > 0)
{
int randomInt = new Random(System.currentTimeMillis()).nextInt(list.size());
randomList.add(list.get(randomInt));
list.remove(randomInt);
}
return randomList;
}
So with that imagine doing it with "_id"'s before asking the cursor for rows (though you would need all the primary keys to start with to do that on)... hope that gives you enough to start with
as for anims thats part of the view class and much info on d.android.com
To randomize the list use Java's Collections. Shuffle method and pass in ur list.
In order to display animations, after u call startactivity, make a call to overridependingtransition and pass in animations for the entering and exiting activity.
Sent from my XT1022 using XDA Free mobile app

Categories

Resources