which package the function setSilent lived in ?

by Breese.Kay » Sat, 22 Aug 2009 01:52:45 GMT


Sponsored Links
 hi,all.
the url

 http://developer.android.com/intl/zh-TW/guide/topics/data/data-storage.html 

at the first example .

       boolean silent = settings.getBoolean("silentMode", false);
       setSilent(silent);


I can't find the function setSilent in the manual.
who can tell me? thanks.

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



Other Threads

1. XML Parsing Error

Hi All,
I m just tried XML parsing in Android activity class...When i run the
application i m getting unKnown Error in Screen...

This is my Activity Class
import java.net.URL;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class ParsingXML extends Activity {

        private final String DEBUG_TAG = "ParsingXML";
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        try{
                URL url = new URL("http://www.anddev.org/images/tut/basic/
parsingxml/example.xml");

                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser sp = spf.newSAXParser();

                XMLReader xmlReader = sp.getXMLReader();
                ExampleHandler exampleHandler = new ExampleHandler();

                xmlReader.setContentHandler(exampleHandler);
                xmlReader.parse(new InputSource(url.openStream()));

                ParsedExampleDataSet parsedExampleDataSet =
exampleHandler.getParsedData();

                tv.setText(parsedExampleDataSet.toString());

        }catch(Exception e){
                tv.setText("Error: " + e.getMessage());
            Log.e(DEBUG_TAG, "ParsingXMLError", e);
        }
        this.setContentView(tv);
    }
}

And my ExampleHandler class

is
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class ExampleHandler extends DefaultHandler{

        private boolean in_outertag = false;
        private boolean in_innertag = false;
        private boolean in_mymytag = false;

        private ParsedExampleDataSet myParsedExampleDataSet = new
ParsedExampleDataSet();

        public ParsedExampleDataSet getParsedData(){
                return this.myParsedExampleDataSet;
        }

        public void startDocument() throws SAXException{
                this.myParsedExampleDataSet = new ParsedExampleDataSet();
        }

        public void endDocument(){

        }

        public void startElement(String nameSpaceURI, String localName,
String qName, Attributes atts) throws SAXException{
                if(localName.equals("outertag")){
                        this.in_outertag = true;
                }else if(localName.equals("innertag")){
                        this.in_innertag = true;
                }else if(localName.equals("myTag")){
                        this.in_mymytag = true;
                }else if(localName.equals("tagwithnumber")){
                        String attributeValue = atts.getValue("thenumber");
                        int attr = Integer.parseInt(attributeValue);
                        myParsedExampleDataSet.setExtractedInt(attr);
                }
        }

                 public void endElement(String namespaceURI, String localName,
String qName) throws SAXException{
                         if(localName.equals("outertag")){
                                 this.in_outertag = false;
                         }else if(localName.equals("innertag")){
                                 this.in_innertag = false;
                         }else if(localName.equals("myTag")){
                                        this.in_mymytag = true;
                                }else if(localName.equals("tagwithnumber")){
                         }
        }

                 public void characters(char ch[],int start, int end){
                         if(this.in_mymytag){
                                 myParsedExampleDataSet.setExtractedString(new
String(ch,start,end));
                         }
                 }

}


ParsedExampleDataSet class is this
public class ParsedExampleDataSet {
        private String extractedString = null;
        private int extractedInt = 0;

        public void setExtractedString(String extractedString){
                this.extractedString = extractedString;
        }

        public String getExtractedString(){
                return this.extractedString;
        }

        public void setExtractedInt(int extractedInt){
                this.extractedInt = extractedInt;
        }

        public int getExtractedInt(){
                return this.extractedInt;
        }

        public String toString(){
                return "ExtractedString = " + this.extractedString
                    + "\nExtractedInt = " + this.extractedInt;
        }

}


when i run this application i m getting this error

10-18 19:46:33.697: ERROR/OSNetworkSystem(203): unknown socket error
-1
10-18 19:46:33.757: ERROR/ParsingXML(203): ParsingXMLError
10-18 19:46:33.757: ERROR/ParsingXML(203): java.net.SocketException:
unknown error
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native
Method)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java:
79)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java:
59)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
java.net.Socket.checkClosedAndCreate(Socket.java:763)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
java.net.Socket.connect(Socket.java:910)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:
61)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:
67)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:
800)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
786)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1030)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
java.net.URL.openStream(URL.java:664)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
com.dreamapp.parsingxml.activity.ParsingXML.onCreate(ParsingXML.java:
34)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2103)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.os.Handler.dispatchMessage(Handler.java:88)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.os.Looper.loop(Looper.java:123)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
android.app.ActivityThread.main(ActivityThread.java:3742)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
java.lang.reflect.Method.invokeNative(Native Method)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
java.lang.reflect.Method.invoke(Method.java:515)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:739)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
10-18 19:46:33.757: ERROR/ParsingXML(203):     at
dalvik.system.NativeStart.main(Native Method)

I m clueless...can somene figure out the error?

Thanks in Advance

Thanks
JavaAndroid
--~--~---------~--~----~------------~-------~--~----~

2. writing a image to The local memory?

Hey guys, im trying to see if i can create thumbnails for a ftp app,
so i figured id need to download the image file from the server, and
have it stored somewhere, but how would i go about this? or if there
is a easier way to go about this, IE where i dont have to download the
picture, or i can create an image with a url(createImage does this)
and then use the url for the picture to create the thumbnail. if
anyone can help it would be a humongous help for me. Thanks Anthony
--~--~---------~--~----~------------~-------~--~----~

3. Any non-Internet GPS software?

4. what the hell is these errors to my emulator bootup every time??

5. MapActivity and onKeyDown

6. How To: Display an icon on Android desktop, Clicking it displays "Hello World"?

7. Emulator starts but HelloAndroid doesn't run