[android-developers] Digest for android-developers@googlegroups.com - 25 Messages in 15 Topics

Group: http://groups.google.com/group/android-developers/topics

    Nathan <nathan.d.mellor@gmail.com> May 31 09:22AM -0700  

    I've confirmed it happens in 3.2 as well.
    Any advice for finding out if a bitmap is corrupt instead of silently
    failing and wasting a user's time?


    Sabanim <rickdiuk@gmail.com> May 31 09:13AM -0700  

    Oops, something went wrong.
    Something bad happened. Don't worry, though. The Spreadsheets Team has
    been notified and we'll get right on it.
    I have been getting this for 3 days now when I go to submit. Also the
    submit button is gone from firefox. I can see it in chrome.


    Mek Rama <sreeramakrishna.n@newmeksolutions.com> May 31 05:07AM -0700  

    Hello Bhaumik Thaker,
    You need execute the code in a thread.
    For example use asynctask and update the UI thread if required.
    You may need to use Handler on main thread to execute async task so that it
    works in 4.x version and lower versions.
    On Wednesday, May 16, 2012 3:54:29 PM UTC+5:30, Bhaumik Thaker wrote:


    Mek Rama <sreeramakrishna.n@newmeksolutions.com> May 31 05:07AM -0700  

    Hello Bhaumik Thaker,
    You need execute the code in a thread.
    For example use asynctask and update the UI thread if required.
    You may need to use Handler on main thread to execute async task so that it
    works in 4.x version and lower versions.
    On Wednesday, May 16, 2012 3:54:29 PM UTC+5:30, Bhaumik Thaker wrote:


    "G. Blake Meike" <blake.meike@gmail.com> May 31 08:48AM -0700  

    Do you have more information on this problem? I tried to reproduce it and
    could not do so. The following works as I would expect, parsing correct
    XML and generating error messages on malformed XML on emulators running ICS
    (4.0.4) and HC (3.2).
    G. Blake Meike
    The second edition of Programming Android is now on-line:
    protected void onCreate(Bundle savedInstanceState) {
    ((Button) findViewById(R.id.button)).setOnClickListener(
    new View.OnClickListener() {
    @Override public void onClick(View v) {
    EditText txt = (EditText) findViewById(R.id.xml);
    } });
    String parseXml(String xml) {
    String ret;
    try {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(xml));
    Document document = builder.parse(is);
    Element root = document.getDocumentElement();
    NodeList items = root.getElementsByTagName("tag");
    StringBuilder str = new StringBuilder();
    for (int i = 0; i < items.getLength(); i++) {
    Node node = items.item(i);
    ret = str.toString();
    catch (Exception e) {
    ret = e.toString();
    return ret;


    bob <bob@coolfone.comze.com> May 31 08:31AM -0700  

    I have a Samsung Galaxy Tab, and I'm playing back some video on it.
    It is very laggy, and I'm seeing this in the log:
    AwesomePlayer - on video lag update
    Can someone help me understand what is going on here?
    The video I'm playing is nothing special, and I don't see why it should lag.


    JP <joachim.pfeiffer@gmail.com> May 31 06:15AM -0700  

    Correct me if I am wrong folks, any encryption key and method that
    would be used to decrypt resource files would be obfuscated by
    Proguard, assuming the key is kept in the Java source, no?
    So OP would use key-and-method to encrypt resource files in the
    development environment and package the encrypted resource files with
    the apk. At runtime, extract the resource, decrypt using the key and
    BTW, this:
    > Download them from the Internet only on demand, and only ever hold them in RAM.
    doesn't help much. The URLs of resource files could easily be packet-
    sniffed when the device is running on WiFi, and used to milk the
    resource files off of the OP's web server.
    On May 31, 4:47 am, Kristopher Micinski <krismicin...@gmail.com>


    Kristopher Micinski <krismicinski@gmail.com> May 31 10:40AM -0400  

    I think Mark and I were both trying to give reasons as to why this
    would be hard / impossible no matter what, which, yes, I agree with


    JP <joachim.pfeiffer@gmail.com> May 31 06:18AM -0700  

    > and that's even if you ask one of the engineers
    > themselves, something you really shouldn't do.
    Now that statement raised my interest. What's wrong with asking?


    David Olsson <zooklubba@gmail.com> May 31 03:25PM +0200  

    Why take up their time? It's a standard that they don't discuss future
    releases. So there is really no point in taking up their time now, is


    David Olsson <zooklubba@gmail.com> May 31 03:29PM +0200  

    Asking in itself isn't bad. But it's just silly to keep asking questions
    when they have a standard to not answer those kind of questions. It's just
    a waste of time for the person asking the question and the person who
    answers it with a standard response really.


    JP <joachim.pfeiffer@gmail.com> May 31 07:01AM -0700  

    > Why take up their time? It's a standard that they don't discuss future
    > releases. So there is really no point in taking up their time now, is
    > there?
    Well let's say Google wanted Android to drive the Internet of Things?
    (Oh, shoot I forgot, didn't they say they wanted to)
    With the kind of support we're seeing, the answer is probably: ain't
    gonna happen, though there's heavier reasons that speak against it
    today (and well into the future).
    Anyway, just sayin'


    Guilherme Utrabo <utrabo@gmail.com> May 31 10:26AM -0300  

    I have to do some heavy processing in my application. The process comprises
    a series of routines which has no dependency between them, and could be
    parallel. I would like to know if there would be some gain if I start
    threads for each routine in order to parallelize the execution or whether
    it would be a bad practice.
    Thanks in advance.


    JP <joachim.pfeiffer@gmail.com> May 31 06:20AM -0700  

    Shane Isbell is back; haven't heard in a while!


    Rohan Tilekar <mail.rohan247@gmail.com> May 31 06:09AM -0700  

    *This is the xml which i want to parse and display .*
    HHNo ID="0" NodeDescription="HHNo510270(10)" Description="HHNo510270"
    PageCount="10" Value="0" MindsID_DocID="0#0" DateValue="" DocName="#"
    <HHNo ID="1" NodeDescription="OUT PATIENT DEPARTMENT(10)"
    Description="OUT PATIENT DEPARTMENT" PageCount="10" MindsID_DocID="0#0"
    DateValue="" DocName="#" Cabinetid="38">
    <HHNo ID="2" NodeDescription="17-OCT-2011 Visit - Prasad Vaidya(10)"
    Description="17-OCT-2011 Visit - Prasad Vaidya" PageCount="10"
    Value="2869@38" MindsID_DocID="0#0" DateValue="17-OCT-2011" DocName="#"
    <HHNo ID="3" NodeDescription="OPD Sheet(10)" Description="OPD Sheet"
    PageCount="10" Value="2869@39" MindsID_DocID="0#0" DateValue="17-OCT-2011"
    DocName="#" Cabinetid="39">
    <HHNo ID="4" NodeDescription="Case Sheet(4)" Description="Case
    Sheet(4)" PageCount="4" Value="1233405@40" MindsID_DocID="788#788"
    DateValue="17-OCT-2011" DocName="00000788.pdf" Cabinetid="40" />
    <HHNo ID="5" NodeDescription="OPD Continuation Sheet(6)"
    Description="OPD Continuation Sheet(6)" PageCount="6" Value="1233405@42"
    MindsID_DocID="789#789" DateValue="17-OCT-2011" DocName="00000789.pdf"
    Cabinetid="42" />


    Panam <pandemira@googlemail.com> May 31 05:51AM -0700  

    Thanks for your valuable insights.
    On Wednesday, May 30, 2012 4:15:06 PM UTC+2, G. Blake Meike wrote:
    > background (14 on my ICS Galaxy) it starts killing them off. They are
    > restarted in new processes as needed. The new process will need its state
    > re-initialized.
    I wasn't aware of that and yes, the process count sometimes goes up to that
    number (a lot of Binder and AsynTask threads show up then). As I presume
    the thread is not re-created by the system as a handler thread when it
    was killed by it before (does somebody have more information on this?) and
    thus the looper is not initialized, this might explain the issue.
    > ...note, btw, that calls to quit() don't have anything to do with the
    > value of the field (I presume) sharedPrioThread.
    Sorry, I am experimenting with 4 shared threads, each with the same setup
    but different priorities; seems like I have a mismatch in the code I posted
    here (so its the source of on of the other 3 threads). Just imaging
    "sharedPrio" being "sharedWorker" and it should be consistent.
    The rationale of using 4 threads is that i wanted to find the right
    priorities for the different tasks I am doing. Some of them lagged
    substantially behind the others and I tried to speed them up using a higher
    priority. Finally it turned out that the bottleneck is most probably
    DB-Inserts (so an IO bottleneck).
    One thing I noticed when watching CPU load and frequency (with the
    SystemPanel Lite App) is that is that Android seems to adjust the frequency
    based on the amount of "urgent" things to do (i.e. threads with a higher
    priority). So this could lead to the situation that some background stuff
    (i.e. low prio threads) are not getting CPU time although there is work for
    them. It seems to me Android just does not want to increase the clock
    frequency to save engery. Is this basically correct and is there some more
    backgroud information on the scheduler somewhere?
    > best things that is coming from the Java communities' interactions with
    > Android is that they may, finally, quite lazily initializing everything.
    > It makes programs more complex and it is only rarely useful.
    Hope I got your point here. Yes, I am from a Java background (Web/ORM) and
    just a bit "used to lazy initialization", and thought it does not hurt to
    maintain this practice especially in resource constrainted environments.
    > if sharedPrioThread were static final initialized at creation, I don't
    > think you'd have the problem.
    Will try this and report back if I see the problem again.
    > Marakana
    > The second edition of Programming Android is now on-line:
    > http://shop.oreilly.com/product/0636920023005.do
    Thanks again!


    giles ian <gilesian.513@gmail.com> May 31 05:26PM +0530  

    Thanks Mark, So what you are trying to say is if i don't use
    ActionBarSherlock then i wont get ActionBar on 2.2 and 2.3, which will mean
    there will absolutely be no change (ui wise) in my my but when it runs on
    3.0+ an action bar will pop up.
    Now if this is the case what code changes do i need to make.


    Mark Murphy <mmurphy@commonsware.com> May 31 08:32AM -0400  

    > ActionBarSherlock then i wont get ActionBar on 2.2 and 2.3, which will mean
    > there will absolutely be no change (ui wise) in my my but when it runs on
    > 3.0+ an  action bar will pop up.
    > Now if this is the case what code changes do i need to make.
    None, probably, other than setting your targetSdkVersion to 11 or
    higher, which you already have done.
    Mark Murphy (a Commons Guy)
    http://commonsware.com | http://github.com/commonsguy
    http://commonsware.com/blog | http://twitter.com/commonsguy
    _The Busy Coder's Guide to Android Development_ Version 3.7 Available!


    Terry <terboel@gmail.com> May 31 05:07AM -0700  

    > your local tax authorities and perhaps even legal council about this than
    > just people guessing on/talking how it is in their country on a mailing
    > list.
    So what you are saying, is that these TAX/VAT issues are too complex
    to be discussed here - with fellow developers - and that each of us
    should consult tax authorities and legal council in order to continue
    developing Android apps - even as a hobby, for fun or pleasure?
    I am afraid that you are right, and that each of us has to register
    for VAT in at least every EU country.
    I am also afraid that this will not happen.


    David Olsson <zooklubba@gmail.com> May 31 02:19PM +0200  

    I am saying that you are better of seeking consult a professional than just
    guess things since there are consequences if things are done incorrectly.
    In my country we are allowed to ask questions to the tax authority about
    things like this. And perhaps even find local groups to ask this to and not
    just hire expensive legal council.
    Seeking council from the local tax authority is what I've done and I've
    also received good advice and information. These kind of questions pop up
    here once in a while and they are never really resolved.


    LordMaKo <juanman234@gmail.com> May 31 04:52AM -0700  

    i have a ListFragment in a tabHost based app
    with only linearLayouts with "extends Fragment" on my tabs it works fine ,
    but I need to place a ListFragment on one of my tabs,
    so the app crashes when i touch the tab with the ListFragment, ;(
    here the code for the "tab_fragment"
    package com.orchard.elasto;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import android.content.Intent;
    import android.os.Bundle;
    import android.support.v4.app.Fragment;
    import android.support.v4.app.FragmentActivity;
    import android.support.v4.app.FragmentManager;
    import android.support.v4.app.ListFragment;
    import android.support.v4.app.LoaderManager.LoaderCallbacks;
    import android.util.Log;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.AdapterView;
    import android.widget.LinearLayout;
    import android.widget.SimpleAdapter;
    //public class Tab2Fragment extends Fragment { //primera pregunta, lo puedo hacer asi o con FragmentActivity
    public class Tab2Fragment extends FragmentActivity { //primera pregunta, lo puedo hacer asi o con FragmentActivity
    private FragmentManager fm;
    private ListFragment list;
    private List<Map<String, String>> listItems;
    private String[] froms;
    private int[] viewIds;
    protected void onCreate(Bundle savedInstanceState) {
    fm = super.getSupportFragmentManager();
    this.listItems = new ArrayList<Map<String, String>>();
    this.list = (ListFragment)fm.findFragmentById(R.id.index_list);
    //set OnClick Listener
    this.list.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
    /* (non-Javadoc)
    * @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView, android.view.View, int, long)
    public void onItemClick(AdapterView<?> parent, View view, int position,
    long id) {
    switch(position) {
    case 0:
    //IndexActivity.this.startActivity(new Intent(IndexActivity.this, TabsFragmentActivity.class));
    Log.i("mako", " es zeroo");
    case 1:
    //IndexActivity.this.startActivity(new Intent(IndexActivity.this, ViewPagerFragmentActivity.class));
    Log.i("mako", " es uno");
    case 2:
    //IndexActivity.this.startActivity(new Intent(IndexActivity.this, TabsViewPagerFragmentActivity.class));
    Log.i("mako", " es dos");
    //this.froms = new String[] {"name"};
    //this.viewIds = new int[] {android.R.id.text1};
    /* (non-Javadoc)
    * @see android.support.v4.app.FragmentActivity#onResume()
    protected void onResume() {
    // bind data to the view
    if (this.listItems.isEmpty()) {
    this.bind(0, "name", "Tab Fragments Example");
    this.bind(1, "name", "ViewPager Example");
    this.bind(2, "name", "Tabs View Pager");
    // Initialise List Adapter
    this.list.setListAdapter(new SimpleAdapter(this, this.listItems, android.R.layout.simple_list_item_1, this.froms, this.viewIds));
    * Binds the key-value data pair to the list item at the specified list position
    * @param pos List item position
    * @param col the column name
    * @param val column value
    * @return the mapping of column values
    private Map<String, String> bind(int pos, String col, String val) {
    Map<String, String> map = null;
    if (!this.listItems.isEmpty() && pos < this.listItems.size())
    map = this.listItems.get(pos);
    else if (map == null) {
    map = new HashMap<String, String>();
    this.listItems.add(Math.min(pos, this.listItems.size()), map);
    map.put(col, val);
    return map;
    and here my xml
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    the errorLog:
    05-31 21:07:38.402: W/dalvikvm(264): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
    05-31 21:07:38.412: E/AndroidRuntime(264): FATAL EXCEPTION: main
    05-31 21:07:38.412: E/AndroidRuntime(264): java.lang.ClassCastException: com.orchard.elasto.Tab2Fragment
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.support.v4.app.Fragment.instantiate(Fragment.java:384)
    05-31 21:07:38.412: E/AndroidRuntime(264): at com.orchard.elasto.ElastoTabsActivity.onTabChanged(ElastoTabsActivity.java:145)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.widget.TabHost.invokeOnTabChangeListener(TabHost.java:356)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.widget.TabHost.setCurrentTab(TabHost.java:341)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:453)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.view.View.performClick(View.java:2408)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.view.View$PerformClick.run(View.java:8816)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.os.Handler.handleCallback(Handler.java:587)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.os.Handler.dispatchMessage(Handler.java:92)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.os.Looper.loop(Looper.java:123)
    05-31 21:07:38.412: E/AndroidRuntime(264): at android.app.ActivityThread.main(ActivityThread.java:4627)
    05-31 21:07:38.412: E/AndroidRuntime(264): at java.lang.reflect.Method.invokeNative(Native Method)
    05-31 21:07:38.412: E/AndroidRuntime(264): at java.lang.reflect.Method.invoke(Method.java:521)
    05-31 21:07:38.412: E/AndroidRuntime(264): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    05-31 21:07:38.412: E/AndroidRuntime(264): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    05-31 21:07:38.412: E/AndroidRuntime(264): at dalvik.system.NativeStart.main(Native Method)
    05-31 21:07:38.442: W/ActivityManager(70): Force finishing activity com.orchard.elasto/.ElastoTabsActivity
    So i what Im I doing wrong and or missing PLEASE!
    thanks a lot!


    LordMaKo <juanman234@gmail.com> May 31 05:18AM -0700  

    Ok, so I see a very big error, but don't know how to fix it
    On my class declaration , im using wrong cast??
    //public class Tab2Fragment extends Fragment { //primera pregunta, l
    public class Tab2Fragment extends FragmentActivity {
    Im using FragmentActivity
    But I should be really using Fragment
    But if i do just this change all my code won't work, so how to adapt it for
    using only Fragment?
    thanks a lot!


    Mark <markmchugh@gmail.com> May 31 05:00AM -0700  

    I am opening the camera using this code
    camera = Camera.open(); // <8>
    Camera.Parameters parameters = camera.getParameters();
    But when I save a photo to the sdcard its saved as landscape. Here is my
    save code.
    PictureCallback jpegCallback = new PictureCallback() {
    public void onPictureTaken(byte[] data, Camera camera) {
    FileOutputStream outStream = null;
    boolean mExternalStorageAvailable = false;
    boolean mExternalStorageWriteable = false;
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
    // We can read and write the media
    mExternalStorageAvailable = mExternalStorageWriteable = true;
    Log.d(TAG, "Can Write ");
    try {
    String baseDir =
    String fileName = "/" + System.currentTimeMillis() + ".jpg";

    Log.d(TAG, "File: " + baseDir + fileName);
    outStream = new FileOutputStream(baseDir + fileName);
    Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length);
    } catch (FileNotFoundException e) {
    } catch (IOException e) {
    } finally {
    } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
    // We can only read the media
    mExternalStorageAvailable = true;
    mExternalStorageWriteable = false;
    Log.d(TAG, "Cant Write ");
    } else {
    // Something else is wrong. It may be one of many other states, but all
    we need
    // to know is we can neither read nor write
    mExternalStorageAvailable = mExternalStorageWriteable = false;
    Log.d(TAG, "Other Error ");
    How can I save the photo as portrait on the sdcard ?
    Thanks in advance


    dara kok <mrpc.cambodia@gmail.com> May 31 12:09AM -0700  

    ConvertView is used. What else to optimize?
    Profile the part that is slow is a great answer.


You received this message because you are subscribed to the Google Group android-developers.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment