notepad tutorial problem with Input configuration changed

by thisnameagain » Sat, 13 Dec 2008 03:25:37 GMT


Sponsored Links
 When switching from portrait to landscape view when you are creating a
new note, i.e. revealing the keyboard, causes the application to
unexpectedly stop. Has anyone else had this problem? have you fixed
it?



--~--~---------~--~----~------------~-------~--~----~



notepad tutorial problem with Input configuration changed

by radiolistener » Wed, 17 Dec 2008 07:43:22 GMT


 Hi ThisNameAgain,

I don't have a G1 yet, so I can't say I've tried it.  But I've done a
lot with the Notepad example.  If you are on Exercise2, you may want
to forge ahead to exercise3 and see if that solves it.  With exercise
2 it is hobbled, in that it can not save state if it loses focus.
With exercise 3, it has the ability to save state, and is a much more
powerful application.

I have completed exercise1 and exercise2 in video representation on my
site and I am now doing the Ground work on exercise3.

That's my best advice I can give, hopefully it proves helpful.

Best of Luck,

John.
 http://radiolistenersElectricEasel.com 




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. ListView onListItemClick

Hi,
I am creating an application which parses an XML from the web and
displays the items of a <title>tag in another ListView. Basically i
want to know an effecient way of using ListView all throughout the
application.

Ex:
Part
1
Part 2                                                Part 3
My Bookshelf -----Click----->Opens another ListView ---->Book 1-------
Options
Book 2
Help
Exit

I am able to go from part 1 to part 2. but not from part 2 to part3. I
might be doing some mistake in part 1 to part 2 itself.

Please advise. I am very confused and stuck.

My code:

package com.vijay.MogoMenu;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;


public class MogoMenu extends ListActivity      {


        ArrayList linksArray = new ArrayList();
        ArrayList itemsArray = new ArrayList();



        /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<String>
(this,android.R.layout.simple_list_item_1, MENU_NAMES));
    }

    private static final String[] MENU_NAMES = new String[] {
        "My Bookshelf",
        "On the Go",
        "Options",
        "Help",
    };

    public void onItemClick(AdapterView parent, View v, int position,
long id) {
        // Pre-load the image then start the animation
        System.out.println("On Item Click" +position);
        if(position == 0)
        {
                DownloadRSS("http://xmlgwdev.lotusbookworks.com/?
acctid=0bfHgPce7k:Hiw6hsB4fx&listID=1");
        }
        else if(position == 3)
        {
                setContentView(R.layout.help);
        }


    }

    public void onClick(View v) {
        System.out.println("On View Click");
    }

    public InputStream OpenHttpConnection(String urlString) throws
IOException
    {
        InputStream in = null;
        int response = -1;

        URL url = new URL(urlString);
        URLConnection conn = url.openConnection();
        System.out.println("Opening Connection");
        if (!(conn instanceof HttpURLConnection))
            throw new IOException("Not an HTTP connection");

        try
        {
                System.out.println("Obtaining CONNECTION");
            HttpURLConnection httpConn = (HttpURLConnection) conn;
            httpConn.setAllowUserInteraction(false);
            httpConn.setInstanceFollowRedirects(true);
            httpConn.setRequestMethod("GET");
            System.out.println("Connecting");
            httpConn.connect();

            response = httpConn.getResponseCode();
            if (response == HttpURLConnection.HTTP_OK)
            {
                System.out.println("SUPER CONNECTION");
                in = httpConn.getInputStream();
                System.out.println("Bitmap puttin into IMG1");
            }
        }
        catch (Exception ex)
        {
            throw new IOException("Error connecting");
        }
        return in;
    }


    /*Download XML RSS feed*/
        @SuppressWarnings("unchecked")
        private void DownloadRSS(String URL)
    {
        InputStream in = null;
        try {
            in = OpenHttpConnection(URL);
            Document doc = null;
            DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
            DocumentBuilder db;

            try {
                db = dbf.newDocumentBuilder();
                doc = db.parse(in);
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            doc.getDocumentElement().normalize();
            itemsArray.clear();
            linksArray.clear();


            String strTitle = null;
            String strLink = null;

            NodeList itemNodesList = doc.getElementsByTagName("a");

            for (int i = 0; i < itemNodesList.getLength(); i++) {
                Node itemNode = itemNodesList.item(i);
                if (itemNode.getNodeType() == Node.ELEMENT_NODE)
                {
                    //---convert the Node into an Element---
                    Element itemElement = (Element) itemNode;

                    //---get all the TITLES element under the
                    NodeList titleNodes =
                        (itemElement).getElementsByTagName("a");

                    Element titleElement = (Element) titleNodes.item
(0);

                    //---get all the child nodes under the <title>
element---
                    NodeList textitemNodes =
                        ((Node) titleElement).getChildNodes();

                    //---retrieve the text of the <title> element---
                    strTitle = ((Node) textitemNodes.item
(0)).getNodeValue();
                    itemsArray.add(strTitle);
                    System.out.println("ITEM : "+strTitle);
                }
            }

            for (int i = 0; i < itemNodesList.getLength(); i++) {
                        strLink = ((Element) itemNodesList.item(i)).getAttribute
("href");
                    linksArray.add(strTitle);
                    System.out.println("URL LINK: "+strLink);
           }


            in.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        setListAdapter(new ArrayAdapter
(this,android.R.layout.simple_list_item_1,itemsArray));
    }


}


Thanks,
Vijay.C
--~--~---------~--~----~------------~-------~--~----~

2. Resistance touchscreen.

Hi all,

I have a resistance touchscreen panel and use arm11 chip.

Now we use hard-code to make raw date can transform to correct point
for Linux system.
But, I think this is not good idea for each devices.

Could any body know how to do calibration at Android? and can detailed
describe it. Thank you very much.
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Is animated gif (agif) supported in Android Image View

4. google gadgets in Android application

5. Start up

6. Access Linux shell command from within the Android SDK

7. How to stop broadcasting an intent (automatic sms without notification)