Android :: Changing Orientation - Losing All My List Items

May 25, 2010

While I tested my application on an Android Device turning my Android phone from landscape to portrait, results in all the list items in my list view are disappearing.

Android :: Changing Orientation - losing all my list items


Android :: Prevent Custom Views From Losing State Across Screen Orientation Changes

Aug 22, 2010

I've successfully implemented onRetainNonConfigurationInstance() for my main activity to save and restore certain critical components across screen orientation changes.

But it seems, my custom views are being re-created from scratch when the orientation changes. This makes sense, although in my case it's inconvenient because the custom view in question is an X/Y plot and the plotted points are stored in the custom view.

Is there a crafty way to implement something similar to onRetainNonConfigurationInstance() for a custom view, or do I need to just implement methods in the custom view which allow me to get and set its "state"?

View 1 Replies View Related

Samsung Epic 4G :: Keep Losing Desktop Items When Turn Phone On

Nov 8, 2010

Just got my Samsung Epic two days ago and I've noticed that each time I reboot the phone the shortcuts I've placed on my desktop (could be apps or contacts) get lost, but my widgets remain.

Has any one else experienced this? Any fixes? I just installed the 2.1 Upgrade1 on Saturday right after first turning the phone on.

View 1 Replies View Related

Android :: How To Disable List Items On List Creation?

Feb 2, 2010

I'm pretty new to Android dev and still working out a lot of things.I've got a main menu showing using the following code, but can't work out how to disable selected items in the menu. Can anybody help me with some sample code?

View 2 Replies View Related

Android :: Redrawing Widget When Changing Orientation

Apr 26, 2010

I have a widget set up and it displays properly in both portrait and landscape when added to each. But when I change orientation it has the problem "Problem Loading Widget". I delete this, re-add the widget, and it displays correctly. Thus, my widget can support both portrait and landscape but it doesn't survive an orientation switch. What am I missing? Do I need to redraw the widget when orientation is changed? Doesn't it do this automatically? Do I need to call onUpdate() somehow?

View 2 Replies View Related

Android :: Changing Orientation Resets Activity

Jul 7, 2009

I finally got to the point where I was ready to deploy my app to my G1 and test it out and the first thing I noticed was that when I change my phone to landscape view my main activity restarts and resets all of my variables to their default settings. How can I avoid this?

View 7 Replies View Related

Android :: OutOfMemoryError When Changing Screen Orientation

May 8, 2009

I get an OutOfMemoryError every time i change the screen orientation and I am having a hard time finding the mistake...

The Activitie's view consists of an ImageView, two Buttons and a Spinner. I don't have static variables and can't imagine where i could leak a context.

Most of the times, the exception is thrown at setContentView (R.layout.upload); sometimes it goes fine until imgUpload.setImageURI(imageURI);

The images i am displaying are form the G1's camera, so about 500kb and 2048x1536pixels

Here is some code:

CODE:..................

View 3 Replies View Related

Android :: Maintaining The State When Changing The Orientation

May 13, 2010

I am having an application showing ListItems and Dialog boxes in it.. I want that when i change the orientation from Portrait to landscape mode, i need to maintain the state of the application .. I have seperate XMLs for landscape and portrait mode..

View 11 Replies View Related

Android :: Changing Background Color Of ListView Items?

Feb 7, 2010

How can I change background color of ListView items on a pair-item basis. When I use android:backgroundColor in the ListView item layout I can achieve this, however the list selector is no longer visible. I can make the selector visible again by setting drawSelectorOnTop to true but then the selector overlays the whole item.

Any ideas how to change those background colors and keep the selector?

I would rather not change the selector itself.

Authors of GMail application have managed to achieve exactly this so it's definitely possible.

View 5 Replies View Related

Android :: Leaked Window Changing Orientation With SubMenu

Jul 27, 2010

I get a leaked window when I have a submenu visible on the screen and I rotate the screen. If it would be a Dialog I colud call dismiss() in the onStop() before to change the orientation, but with a SubMenu how do I can solve it?

View 5 Replies View Related

Android :: Widget Not Working Properly When Changing Orientation

Jul 8, 2009

I have a widget , thats working just fine in a particular orientation, but the moment i change the orientation to landscape/portrait, the widget is not able to launch. I have one layout and one layout-land folder in res directory.The problem is that the widget created in landscape mode is not opening in portrait mode and vice-versa.

View 4 Replies View Related

Android :: ListView In Activity Getting Refreshed On Changing Orientation

Apr 7, 2010

I have Activity with ListView inside it and in the onCreate method of the Activity I have code for populating the Data of the ListView this Data is a server based and so populating includes calling Network URLs. I have the ArrayAdapter of the ListView in the Same Activity Class.

Now the Issue I'am facing is that, in Rest all scenarios my Activity is behaving in a proper way but when the Orientation [ Portrait to Landscaped or other way round] is taking place the Data is Getting lost and Newer Data calls are Required to Populate the Same Old Data now this is something that is not intended out the code how should I deal with it.

View 4 Replies View Related

Game For Android - Changing Screen Depending On Orientation

Jan 18, 2012

I am working on a game for android at the moment, and was wondering how i would change the screen depending on orientation.

So if the user turned the phone horizontally then the app would be viewed horizontally if you know what i mean

Also how would i make a timer, so if a button were pressed, how would i say stop for 2 seconds and then go to link?

View 3 Replies View Related

Android :: 1.6 SDK Arrow Keys - Dpad/trackball - Dir Not Changing With Orientation

Sep 16, 2009

Just started testing my games in 1.6 and the first thing I notice is that on the landscape ones, the dpad up/down/left/right orientation doesn't switch 90 degrees like it did on all emulators before.

The device trackball/dpad will still change with orientation (right becomes up on landscape, etc..), right?

View 9 Replies View Related

Android :: Padding List Items?

May 31, 2010

I have a list where i basically need a hierarchy of items. Any children of an item would be padded slightly, as to easily distinguish their parent item. How could this be achieved? Note that i could, if needed, make each parent show no children, and then when the parent is clicked, a new list containing all of it's children is loaded. This however requires more clicking to display information than i would prefer. Also, the items themselves will contain graphics and whatnot (to show a drag'n'drop button, etc), so it would be best if it visually appeared as if the item itself had a margin, rather than the contents of the item being padded.

View 1 Replies View Related

Android :: List With Grayed Out Items

Aug 7, 2009

In Android, I want to present the user with a list. When an item on the list is selected some action is performed, and this list item is no longer selectable. It is also 'grayed out' or the like to indicate that it cannot be selected the next time the list is displayed. I have seen the isSelectable() override in Adapter, but I believe this causes the item to be treated as a separator, which causes visual problems. And I have not found a way to 'gray out' an item.

View 4 Replies View Related

Motorola Droid X :: Screen Orientation Not Changing?

Jul 16, 2010

I'm not sure If I did something to my phone after hours and hours of playing and installing/uninstalling ... but my screen orientation no longer changes to landscape when I rotate the phone!

View 1 Replies View Related

HTC Hero :: Animation In Web Browser Changing Orientation

Oct 3, 2009

I've seen on YouTube quite nice animation as browser changes from portrait to landscape. I don't get this, even after selecting 'show animation' in settings. How can I get this?

View 3 Replies View Related

Android :: List Items With Alternating Colors

Jan 12, 2010

I have a list view and an adapter that sets alternating background colors to the list items ("zebra" list style):

public View getView(final int position, View convertView, ViewGroup parent) {
int colorPos = position % colors.length;
...
convertView.setBackgroundColor(colors[colorPos]);
return convertView;}

But now, when i select an item using scroll wheel, or when I click an item, the original colors for selecting/clicking do not override my custom backgrounds (I can see the original color below the one I set).
How can I set the original colors for these states?

View 2 Replies View Related

Android :: Widget With Scrollable List Of Items

Apr 27, 2010

I cannot find any example of a widget showing a scrollable list of items (e.g. text) since the widget api says there is no listview, no scrollview etc.. at all, how to implement a scrollable list inside a widget?

For example a list like friends-stream from HTC shows or many other widgets around.... do i have to code my own list-implementation for a widget.

View 9 Replies View Related

Android :: Two Selectable Items In Each List In ListView

Dec 16, 2009

The way I want it is, per row there will be a text and is followed by a right arrow button, so that the user can click on that button to edit the content of that row. If the user is using the keypad, by using the left and right buttons on the keypad, he should be able to select the textview or the Button in that particular row. I have seen this in a couple of apps. The way I see that working on those apps appear as if they are maintaining two lists in parallel.

The reason i felt it this way is, if I am on row 1 of the list and if I press the right key on the phone keypad, then the right arrow button will get highlighted and now if I use the down key or if I keep pressing the down key, then the focus will scroll through that arrow button only as if that is an another parallel list constructed. I don't know if that is a good way to do it. I tried many for getting this to work, but couldn't succeed.

View 4 Replies View Related

Android :: Editing List Items In ListView

Sep 2, 2010

I have a listview from an SQLDatabase using custom CursorAdaptor. I would like to go back to the activity that I used to create the items when I click on them in the listview. So that I can edit the entries. But nothing happen when I implement the OnItemClick method and the getItemId() on the CursorAdapter even though am not sure I am correct there. Here is my Code:

public void onItemClick(AdapterView<?> adapview, View view, int position, long rowId) {
Cursor c = adapter.retrieveRow(rowId); // retrieve row from Database
Intent edit = new Intent(this,NewItem.class);
edit.putExtra(DBAdapter.KEY_ID, rowId);
edit.putExtra(DBAdapter.Title, c.getString(c.getColumnIndex(DBAdapter.Title)));
edit.putExtra(DBAdapter.DATE, c.getString(c.getColumnIndex(DBAdapter.DATE)));
startActivity(edit); } public long getItemId(int id){ return id; }

View 1 Replies View Related

Android :: Displaying List Items In ListView

Oct 16, 2010

I've got the following main.xml:

<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout
android:id="@+id/widget0" android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" >
<ListView android:id="@+id/listview" android:layout_width="315px"
android:layout_height="379px" android:layout_x="2px" android:layout_y="50px" >
</ListView> <TextView android:id="@+id/title" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Select device:" android:textSize="17sp"
android:layout_x="-2px" android:layout_y="1px" >

</TextView> <Button android:id="@+id/refresh" android:layout_width="109px"
android:layout_height="wrap_content" android:text="Refresh" android:layout_x="209px android:layout_y="7px" >
</Button> </AbsoluteLayout>

The main class does nothing but drawing the layout. I've got the following class and layout for the listitems:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="10dp" android:textSize="16sp" >
</TextView> package com.android.bluetoothp2p;
import android.app.ListActivity; import android.os.Bundle;
import android.view.View; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.TextView;
import android.widget.Toast;

public class BTListView extends ListActivity {
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES)); ListView lv = getListView();
lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show(); } } ); }

Countries is just an array with a list of countries, some dummy values. Now, how do I make the list items of the BTListView class go in the ListView (with @+id/listview) of the main class? Now my list works, but it isn't clickable anymore. This is the code:
ListView lv = getListView(); lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), "lolwat", Toast.LENGTH_SHORT).show();
} } );

View 1 Replies View Related

Android :: Add Multiple Items In List View

Feb 5, 2009

Can any one please tell me how to add multiple items (images/text) in list view?

View 4 Replies View Related

Android :: Disable Items In List View

Oct 27, 2010

I want to disable few items in List View and i am using Simple Adapter to do that. I am not getting how to disable the items.

View 3 Replies View Related

Android :: Possible To Rearrange Items In List View?

Sep 4, 2010

On the iPhone a user is able to re-arrange the actual rows in a list. Is this possible on Android? If so, any examples would be great.

View 2 Replies View Related

Android :: Use ActivesyncTask - Add Items To List View

Jul 6, 2010

I am trying to add ListView items one by one. So if I have say 60 items the application would add the views to the list view one at a time -- thus showing the user that the application is loading more things. This is my code:

try {
JSONArray j = getTaggsJSON();
Log.v(TAG, String.valueOf(j.length()));
a = new createSpecialAdapter(this, R.layout.individual_tagg_view,
R.layout.list_item, view, j);
ListView v = this.getListView();
v.setStackFromBottom(true);
setListAdapter(a);
new addViewsToList().execute(j);

} catch (UnknownHostException e) {.....

View 1 Replies View Related

Android :: Check Items Form List

Sep 27, 2009

what code i'd use to get what checkboxes are checked when i press the ok button for the code below.

inal CharSequence[] tags = {"first", "2nd", "third"}; boolean[] f=new boolean[tags.length]; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Filter"); builder.setMultiChoiceItems(tags, f, null); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {

View 5 Replies View Related

Android :: Color Spinner List Items

Jun 5, 2009

I am trying to change the text color of the spinner list items individually. I would like to be able to color the top three texts black and then the bottom four grey. This way the last items look disabled, but I still want to be able to capture the event when they are chosen. I haven't been able to find any documentation on how to do that. Alternatively I would like to disable som list items, but still be able to capture the event when they are chosen.

View 5 Replies View Related

Android :: Can't Access AlertDialog List Items

Dec 6, 2009

How can I access items I previously set using AlertDialog.Builder?

private static final CharSequence[] skill_levels = { "Rookie", "Average", "Expert" };
skillLevelBuilder = new AlertDialog.Builder( this ); skillLevelBuilder.setTitle( "Change Skill Level" ); skillOnClick = new DialogInterface.OnClickListener() { [...] }

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved