Convert existing app to use Fragments - android

I am new to Android and have an app on the Market that I would like to convert to use Fragments so it could take advantage of the tablet in landscape mode and have both activities side by side. All of the examples I can find out there use a listview with a image or text in the right column and uses the FragmentList class. My app has an Activity that has buttons and depending on what buttons or spinners they select it then displays another activity. Can anyone recommend a tutorial or article on how to do this? I have read the Google blog but found it confusing and wasn't sure how to use it to modify my existing code. Any help would be appreciated.

This is a good tutorial http://portabledroid.wordpress.com/2011/04/19/programmatic-and-layout-fragments/

Related

Android - App with layouts only - without controllers

I'm programming an app in Android.
My client needs a 'dummy' like application, I mean, an app with all layouts but just navigable, without the actual controllers or activities, just navigate through layouts. By clicking buttons, but just pass to the other layouts without executing java or whatever code.
My question is, is this possible in AndroidStudio?
Or should I generate another kind of graphical app in order to accomplish this?
Any ideas?
Thanks in advance!
The short answer to your question (as I understood it) is no. You have to have activities to have an android app that will function. You could create a very rudimentary set of activities to do what you want.
However, if you are simply trying to create a mockup of what the app will look like for your client, I suggest using a tool like FluidUI. This will allow you to layout the general look and feel of your app without any actual code required.
Let me know if this helps!

General android layout questions

I should begin by saying that I'm brand new to android development, although I have a good understanding of the fundamentals of java. That being said, I usually learn best by doing, so I'm writing an app for a campus magazine I work for and trying to learn through the process of making it.
At the top of the screen is a bar with two spinners labeled "issues" and "sections," which allow the user to filter the articles shown to only those in the respective issue / section. The rest of the screen is taken up by what I will describe as a vertically-oriented gallery, which shows the headline for each story underneath an image associated with it. The user can then "flip" through the stories in the magazine by scrolling through the "gallery." Selecting one of the stories will open the full story up in ViewPager.
I have two main questions at this point:
1) Initially, I planned to place the "issues" and "sections" spinners in the ActionBar. However, as I understand it, ActionBars are not displayed to users using Android 2.x. Given that these elements are critical to navigating the app, and that a majority of android users are still using 2.x, this seems unacceptable. As a result, I'm using an ActionBar-less theme and essentially drawing my own action bar via a linear layout on top of my main activity. Am I correct in my understanding that ActionBars do not display on Android 2.x devices? If so, am I correct in including my "tool bar" as a part of the main activity, or is there a better way to implement it? (Perhaps as a fragment? I don't really understand how those fit in yet...).
2) I am aware that the gallery widget is deprecated, so obviously I'm not going to use it. What alternative widgets would best achieve the same visual goal of having the user "flip" through the stories in the magazine by scrolling through the widget? Is there a way to animate a ListView to achieve this goal?
Again, any help - particularly which helps me to understand the wider issues involved here - will be greatly appreciated.
Thanks in advance.
You can use ActionBarSherlock - it is compatible down to Android v 1.6.
ViewPager might help you

Android - Reading data from tabs / fragments

I'm working on an Android app that does nothing more then storing data in a SQLite database and displaying it.
Since I have a .NET background I started off developing the app with MonoDroid (C#). After developing the app with MonoDroid I thought it would be fun to redevelop it with Java and learn along the way.
In the original app I used a TabActivity and created 4 tabs to stucturize the data I want to save in a single table. Underneath the tabs I placed a button. A click on the button collects all data on the 4 tabs to store it, and it worked perfect.
Now developing with Java I noticed that the TabActivity is deprecated and I found out that I have to use fragments. I was able to create the tabs following this article. However, I am no longer able to read the data on the tabs. I searched online and tried the most ridiculous "solutions" for a couple days in a row now, and I start to doubt if the functionality I look for is possible.
Please advise me what to do! Is it possible to recreate this functionality using fragments? If so, can anyone give me some pointers?
If not, what would be the best way to approach this?
Thanks in advance!

How to use Multi-pane layouts with ViewPager

The Android Design guidelines suggest using Multi-pane layouts, but as far as actually implementing this there are no examples given. Specifically I'm referring to the dual-pane layout used in conjunction with ViewPager like in the People app shown in the guidelines.
Does anyone have some advice or examples to give on implementing this?
In the screen shot:
You can swipe with ViewPager back and forth between the About and Updates lists or you can tap on the photos to page over. You can see a small part of the Updates tab while viewing whatever you have in the About tab and visa versa. Specifically, I want to know how to create this multi-pane layout. The screen shot is from the People app in Ice Cream Sandwich.
SOLVED:
I ended up creating my own open sourced library for this widget. You can find it at this address:
https://bitbucket.org/adneal/tabcarousellib/wiki/Home
For View Pager first you go through this svn.I have gone through android developer site.If you want multi-pane Layout with out Fragment then it very difficult.I will suggest you to go for the Fragment and achieve your multi-pane layout.
But one i can understand your problem also as Fragment are available from Android 3.0 (API level 11).If you want to target device below this then it became necessity to use View Pager.So you have to work hard to achieve it.
Study this for creating horizontal List View
Try this first If you can Customize it
ViewPager Indicator in android
First of all as I got you want to implement the SplitView in android.
If yes then Use this link to get information of fragments from developer site.
Use this Demo of developer site.
If not getting solution then use this Demo Example : Demo
If still its not what you want then also let me know.
I will like to help you.

Android: A good looking (standard) settings menu

I'm trying to get my app to blend in as much as possible with the "standard" with the rest of my android device. It's a stand-alone app, not integrated with the OS or anything, I just want it to look familiar.
The area I'm interested in is the "settings" screen. If I look at Android's standard settings screen, it's well spaced, perfect font size, with neat pin stripes between the menu items.
How do I do that? Is that a ListView? Is it done with a regular LinearLayout?
I would love to be able to replicate the look & feel in my app. Can anybody assist?
And it's not just the Adroid OS. it's most of the "professional" apps out there:
Many thanks
Actually, this is directly part of the Android source code, so I would strongly advise you to take a look in its structure. See the Android Settings tutorial for more info.
Settings are created from the SettingsActivity (which extends the PreferenceActivity, you might want to look this too), which in their turn have their layout based on the following xml files:
preferences.xml
preference.xml
Things are quite strongly interlocked so it needs some reading...
AFAIK its a ListView. by implementing a custom ListView, you can achieve similar effect.
Moreover, you'll have to follow the Icon Design Guidelines to create such icons for ListView rows

Categories

Resources