Listview in andengine - android

I want to implement a list like a leaderboard into my project. I saw an example which usw the Android native ListView class but is this the right way? Does any body know a solution?;)

I don't have a solution but since you got no answer yet, I wanted to inform you that I used the native ListView class and it worked like a charm !
Easy to implement and I haven't heard about any other way to do so with Andengine yet (there might be though). This only is a return of experience, hope it helps !

Here is a tutorial that will demonstrate how to create, add and update ListViews:
http://www.vogella.com/tutorials/AndroidListView/article.html
After practicing the concepts in the tutorial, please keep in mind that every row in a list (a separate view) is recycled - while you do not need to inflate it again, you do need to ensure that you set/selete/update any and all information on it, otherwise you get funky bugs. Hope this helps.

You can use the approach from Google Play Game Services.
Your game activity can extend AndEngine's BaseGameActivity. The leader-board activity can extend a normal ListActivity.
In your game start the leaderboards activity with startActivityForResutl. When the user is done, he just goes back to your game activity.

Related

A view for a game without a layout

I'm at the beginning of my development for my game and I have a basic question.
Is the layout necessary for displaying a view?
I have the method which allows me to make the toolbar disappear and set the view screen wide, but it seems a bit useless to do so.
Besides in the snake sample provided in the sdk, the views are merged without a layout.
So, which one is the best practice.
And if it's the layout-less solution, how to do for a unique view to display?
Thanks.
Well, I am as new as you are too, but as far as I have searched and learned online and with a few examples, all I can say is, NO. Game programming does not need any xml layouts. For developing a game, you need to first create a good basic framework. All the views, sprites, actions, audio, etc... is created at background.
This is a very nice tutorial to start with.
It depends on lots of things, but yes you don't need to create an XML layout. Pay attention to the word XML. You can create a custom class which extends SurfaceView and work in cooperate with Thread to do the update. So in this case you just need to set your Activity's Content View to this subclass of SurfaceView. But by using SurfaceView you have a raw of context which means you should do everything from stratch, e.g you should implement your own button.
Beside this it depends on the engine/framework you use too. But for SurfaceView/Canvas API the lines I mentioned above is valid.

android: How can I implement first time tutorial like Go Launcher in my app?

Go Launcher have a nice first-time tutorial. it is very similar to Stock ICS first time run. I want to learn how to make the similar tutorial display at the first launch of my app. How can I implement this Transparent view (which interacts with screen objects) in my android app?
I was trying to do something similar using a transparent activity with a viewpager inside it. I wanted static 'tutorial' images that users could swipe through.
One of the answers to my question mentioned an interesting library (called ShowcaseView). It seems like it may be a good fit for your requirements as well.
https://github.com/Espiandev/ShowcaseView
You can either use a FrameLayout or RelativeLayout as root of your Activity/Fragment, and put your "first time" View upon content with a (almost) transparent background, or use another Activity/Fragment themed with a transluscent window. (like this)
I'd rather use an Activity/Fragment, but this is up to you!
I wrote little library That contains a simple component for making ​​a app tour. It`s very restricted to my case but maybe could be your case . Single LessonCardView Showed onstartactivity for the first time or on button click Any criticism ,help or advice will be appreciated. thanks https://github.com/dnocode/DnoLib
You can implement a first-time user guide with the Spotlight library by TakuSemba.
It is similar to the one shared above and it is still well-maintained (as of 2021).
https://github.com/TakuSemba/Spotlight

Suggestion of UML diagram

I need to draw a diagram but I am not sure what sort of diagram that is appropriate for my application.
It is a mobile application that contains:
Splash (as welcoming scree)
Main Menu Screen (Which contains)
Gallery
Settings
Map
Help
The Gallery has contain all the images/photos that is stored on the device.
Can anyone suggest what sort of UML that is appropriate for this application? Is it Use Case Diagram? or Sequence Diagram?
Thanks in advance.
Hi every application/project requires activity diagram for its final implementation besides usecase,sequence,statechart.Heres the link hope this will help you
http://www.tutorialspoint.com/uml/uml_activity_diagram.htm
In my opinion, you should be clear about what you're trying to achieve before generating documentation, otherwise you can end up with heaps of useless charts and diagrams.
If I were you, I'd use a Class Diagram with a Use Case diagram.
The Class Diagram will help you and other technically-minded people to understand how your code fits together.
Then use a Use Case Diagram to show the flow of typical use of your program. This should be understandable by anyone.

How to call an activiy itself in android

Basically I am doing a quiz app, I need to dedicate one question to one page, user should be able to flip through the pages to finish one quiz. My proposed idea is to hold a singleton class for all the questions, and have an activity call itself each time for a question, and generate different content according to that question dynamically.But how would one achieve such thing? Can I use intent to call an activity itself? or should there be some other better solutions? thanks
Depending on how many questions you're talking about, the easiest way to do what you're trying to accomplish would be to load up all of your questions into Views and add them to a ViewFlipper. You'd only need one activity, then, and you can animate the transitions between the questions with the ViewFlipper.
You would use startActivity(); or startActivityForResult(); depending on what exactly you wanted to do . Read Here

Possible to start a SurfaceView with a Game Thread anytime other than at startup of the program?

I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way. I've used a couple Activities and xml documents to create a menu that loads when my game starts. When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties. I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu, I get a nullPointerException and it force closes. I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView. I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here. If you need the code snippets I can paste some here, but it's not really the specific code that's wrong, I think it's the way I'm using(abusing) the language...
Thanks for any help,
Aaron
I discovered my problem quite some time ago, but figured I would come back and give an answer to anyone else having my problem. When using a SurfaceView it must be part of the activity that created it and be in some sort of FrameLayout in the xml for that activity.
For example:
<com.example.MySurfaceView
android:id="#+id/mySurfaceView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
You can add any other layout elements you would like, but this is required to create the SurfaceView. I hope this helps anyone else who had my problem, for any further questions just ask and I'll be sure to elaborate if necessary.

Categories

Resources