I am trying to make an app that allows the user to input text, and then images meaning that word come up on the screen. I already have Eclipse set up on my linux 64 bit box. How would I do this, as I am just starting to learn android development? I am trying to make this app using this tutorial: https://developer.android.com/training/basics/firstapp/building-ui.html but changing the activity so it shows images in a sequence (kinda like a GIF). Any way to do this?
Vlasp said:
I am trying to make an app that allows the user to input text, and then images meaning that word come up on the screen. I already have Eclipse set up on my linux 64 bit box. How would I do this, as I am just starting to learn android development? I am trying to make this app using this tutorial: https://developer.android.com/training/basics/firstapp/building-ui.html but changing the activity so it shows images in a sequence (kinda like a GIF). Any way to do this?
Click to expand...
Click to collapse
I think you should create an ArrayList with the images and keywords.
Then if you click the search button you have to loop trough all the items and check if the keywords contain your searched text if so then you add the image to your layout else you don't.
Hope this helps
Sent from my SM-N9005 using XDA Premium 4 mobile app
Rick Clephas said:
I think you should create an ArrayList with the images and keywords.
Then if you click the search button you have to loop trough all the items and check if the keywords contain your searched text if so then you add the image to your layout else you don't.
Hope this helps
Click to expand...
Click to collapse
Agreed, but I think a HashMap<String, Integer> would be better in this case .
@OP: I don't get the second part of the question with the GIF, try to start with only an EditText, a Button and an ImageView. Then learn how to get the text which the user entered and set up the hashmap and your image resources.
SimplicityApks said:
Agreed, but I think a HashMap<String, Integer> would be better in this case .
@OP: I don't get the second part of the question with the GIF, try to start with only an EditText, a Button and an ImageView. Then learn how to get the text which the user entered and set up the hashmap and your image resources.
Click to expand...
Click to collapse
Yes that would probably be better :thumbup:
Sent from my SM-N9005 using XDA Premium 4 mobile app
Related
Hi there, long time lurker first time poster here!
Slowly getting into android but i really cant get my head around the layouts. I would love to be able to use the AbsoluteLayouts but that isn't a good idea anymore.
Basically after some work i have managed to get a gallery working at the top of the screen. I want my app to look like this in essence: Ok can't post outside links at the moment, fair enough. Think of the android market. Icons to the left and a bit of information for each app next to it and a buy button on the right.
However i have no idea where to start off. Since i have the gallery already i have no idea how i can add things underneath it without screwing anything up.
Can anyone help? Thanks in advance!
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
RED_ said:
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
Click to expand...
Click to collapse
Are you using a List View? Looks like one.
How do you build up your content for the list?
In my view the best solution for your problem would be:
- Use a ListView
- Build your own ListAdapter (drived from BaseAdapter for example)
The Adapter builds the view for each item (or recycles an already built up view, the ListView handles that).
The view for each item would be a horizontal oriented LinearLayout with two items (the image and the text) and the adapter fills the layout with the information of the current item.
For better layout handling I would define the layout for the items in an extra xml file and use the LayoutInflater-Service inside the Adapter (if a view has to be built).
Hope this helps and points into a helpful direction
Devmil
Thanks for replying, managed to find a solution in the end without using ListView. Thought about moving to a RelativeLayout as its more effcient but as my app is very small anyway in the end i've just gone and used nested LinearLayouts with a textview and imageview in each one.
Ridiculously simple when you look back on it.
I was actually going to use this tutorial which does what you explained i think: http://www.anddev.org/iconified_textlist_-_the_making_of-t97.html but it left me with a force close error so that went out the window.
Whats the simplest way to print a string to the screen? I don't mean having a predefined string value in an xml file.
Please provide a little context.
eg. At a game over, I want to display the players score on a blank screen
Sent from my GT-I9000M using XDA App
Make a layout with a textview on it
Lakers16 said:
Make a layout with a textview on it
Click to expand...
Click to collapse
If all you are doing is displaying a score you may want to do what im doing, when the game over a show an alertdialog, in that i have all information for that current game. Then for a HighScore screen im using a layout with textviews ect.
Hey,
It's a bit hard to explain, but i'll try.
Well i have a picture with a speechbubble on, in which i want to add a box where the user can add text. When the text is added and the user decides to save the image, i want the text they wrote to be editing onto the image.
So when the picture is saved it has the text the user wrote in the text field to be on the image.
Hope you understand, and i hope this is a place where i can ask
Doesn't picsaypro so this? Check the market.
Sent from my MOTWX435KT using XDA App
boinq said:
Hey,
It's a bit hard to explain, but i'll try.
Well i have a picture with a speechbubble on, in which i want to add a box where the user can add text. When the text is added and the user decides to save the image, i want the text they wrote to be editing onto the image.
So when the picture is saved it has the text the user wrote in the text field to be on the image.
Hope you understand, and i hope this is a place where i can ask
Click to expand...
Click to collapse
You could use a view to draw your stuff onto a canvas, then grab the bitmap of that view with View.getDrawingCache(), then save that bitmap to a FileOutputStream with Bitmap.compress().
Hi all,
Title really says it all. I have a tabs set up at the moment but I want to add a spinner to the action bar as well. To use as sort of a category tool. So a user can go through the tabs but also simply what they are seeing by selecting something from the dropdown spinner.
I've seen tutorials for a spinner in the actionbar and they require the navigation to be changed to list
Code:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
Mine at the moment is of course
Code:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Is it possible to have both? I have a title and tabs underneath to the title action bar is empty at the moment, a perfect place for a spinner. This is what I have right now: http://i1.ytimg.com/vi/ppuv-FP6c4w/maxresdefault.jpg I'd like to be able to add a spinner that is always showing where it says 'ABS ViewPager Tabs'
Any help would be appreciated. Haven't found a tutorial that integrates both yet.
RED_ said:
Hi all,
Title really says it all. I have a tabs set up at the moment but I want to add a spinner to the action bar as well. To use as sort of a category tool. So a user can go through the tabs but also simply what they are seeing by selecting something from the dropdown spinner.
I've seen tutorials for a spinner in the actionbar and they require the navigation to be changed to list
Code:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
Mine at the moment is of course
Code:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Is it possible to have both? I have a title and tabs underneath to the title action bar is empty at the moment, a perfect place for a spinner. This is what I have right now: http://i1.ytimg.com/vi/ppuv-FP6c4w/maxresdefault.jpg I'd like to be able to add a spinner that is always showing where it says 'ABS ViewPager Tabs'
Any help would be appreciated. Haven't found a tutorial that integrates both yet.
Click to expand...
Click to collapse
Since the ActionBarSherlock library is closesly related to the native action bar, I googled and found this similar question. It seems that, using these libraries it is not possible, however there are several methods to use instead (but those aren't so nice).
Bugger. Guess I could try doing it with a custom view and work from there like shown in that link. Hmmm, might have to rethink how my app lets users navigate.
That stuff that I plan to put in the spinner has to be somewhere so I guess I should look to creating this custom actionbar thingy. Hopefully the output is smooth. Already using a ViewPager that the guy who answered mentioned so this may not be too hard.
RED_ said:
Bugger. Guess I could try doing it with a custom view and work from there like shown in that link. Hmmm, might have to rethink how my app lets users navigate.
That stuff that I plan to put in the spinner has to be somewhere so I guess I should look to creating this custom actionbar thingy. Hopefully the output is smooth. Already using a ViewPager that the guy who answered mentioned so this may not be too hard.
Click to expand...
Click to collapse
This video from Google I/O 2013 helped me very much with my app navigation design: http://www.youtube.com/watch?v=XpqyiBR0lJ4&list=PLOU2XLYxmsIJOOTFfYzhR2d-rcSbBbEE_
nikwen said:
This video from Google I/O 2013 helped me very much with my app navigation design: http://www.youtube.com/watch?v=XpqyiBR0lJ4&list=PLOU2XLYxmsIJOOTFfYzhR2d-rcSbBbEE_
Click to expand...
Click to collapse
Thanks, I'll give that watch.
I'm currently using GridViews with custom adapters to show my content under each tab so if I could have an onClick change what the getView() method of the adapter shows to a user I could just keep it really simple and have simple buttons instead of a spinner.
That seems like a good option at the moment.
Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Hello Guys, I'm a newbie in app development so help me with this (simple) query.
I have an activity with 4 text box asking for user input (name, place, date, time) . Now how to combine these data into a table in another activity.
PS: I have included exit button in main activity. Is it ok or should I include exit option in action bar menu only? Also what is the java function to exit the app?
Click to expand...
Click to collapse
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
SimplicityApks said:
Hi,
You can easily get a Table with the TableLayout, where in each TableRow you would put two EditTexts. In Android you usually don't need to put an edit button in the layout unless you have a service running or so since there is the back button to easily exit. The Java code to exit would be calling this.finish() from the activity.
Click to expand...
Click to collapse
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks for your suggestion, but I want all the four editText in a single row. How to do it,? Or is there any detailed tutorial?
Click to expand...
Click to collapse
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
SimplicityApks said:
You can find a tutorial on the TableLayout here. But if you just want one row, it's easier to just use a LinearLayout with equal weights for each View. If you want to reuse this layout for another activity, put it in a Fragment!
Click to expand...
Click to collapse
Thanks but Actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Sent from my Xperia Mini using Tapatalk 2
ariftwister said:
Thanks but actually I'm building an app to keep track all the user's debt. So I want to display the debts in a tabular view. It can be single or multiple varying with every user. So what should I use here?
Also how to place the data got from 4 different edittext as single object into another activity?
Click to expand...
Click to collapse
You may want to have a look at the samples of the TableFixHeaders library here to do your Layout. Remember putting it in a separate Fragment in case you want to reuse in another activity.
For data passing you need to put it as extra into the Intent you're starting the second activity with. The data structure you use depends on what you want to do. I recommend dropping everything into a new Bundle and pass that on, that way you can also save/restore when rotating. But if you have only the same data like 4 Strings or 4 doubles you could also directly put it as an array extra with intent.putDoubleArrayExtra or putStringArrayExtra