ADB bug: italic TextView disappears

by Marco Alexander Schmitz » Tue, 16 Mar 2010 03:14:10 GMT


Sponsored Links
 dear developers,

I am layouting my xml file with eclipse using adb.

Changing the Text Style to italic makes the whole TextView disappears :
(

Greetings,
Marco

--



ADB bug: italic TextView disappears

by Kumar Bibek » Tue, 16 Mar 2010 04:44:05 GMT


 Oh yeah, I have seen that too. But when you run your app, it renders
correctly. So I never cared to file it as a bug.

Thanks and Regards,
Kumar Bibek

On Mar 16, 12:14am, Marco Alexander Schmitz



--


Sponsored Links


Other Threads

1. Quick Yes/No question about the UI thread during a screen rotation

If I remember correctly, if you post a Runnable to a Handler instance
(AsyncTask does this), the messages(/Runnables) are posted back to
your application on the main UI-thread, regardless whether your
activity is active or destroyed.

You do have to check *which* Activity instance is active (or maybe
even none) when the onPostExecute is being called. For this, i use a
static reference to my current activity:

class MyActivity extends Activity {
  ...
  // A single static reference to the currently active
  // activity (note: this is only fool-proof when only one
  // instance at the same time (for a process) can be active)
  private static MyActivity ACTIVE_INSTANCE = null;
  ...

  @Override
  protected void onCreate() {
    ACTIVE_INSTANCE = this;
    super.onCreate();
    ...
  }


  @Override
  protected void onDestroy() {
    ...
    super.onDestroy();
    ACTIVE_INSTANCE = null;
  }

  ...
}

And from within your onPostExecute, you'd use ACTIVE_INSTANCE to show
any updates in the user-interface. Be sure to check if it is null or
not.

Note that is has bitten me in the past a few times using an inner
class that is a subclass of AsyncTask and implicitly referring back to
the Activity that started the AsyncTask. e.g. (ommitting the
generics):

public MyActivity extends Activity {
  private TextView mMyTextView;
  ...
  ...

  public void someMethod(SomeInput input) {
    AsyncTask runInBackground = new AsyncTask() {
      protected Result doInBackground (Params... params) {
        ... do your background stuff here ...
      }

      protected void onPostExecute (String result) {
        ...
        mMyTextView.setText(result);
        ...
      }
    };
    runInBackground.execute(input);
  }
  ...
  ...
}

The problem was that mMyTextView refers to the TextView in an Activity
that may have been destroyed when onPostExecute is called. Instead:

public MyActivity extends Activity {
  private TextView mMyTextView;
  ...
  ...
  private static MyActivity ACTIVE_INSTANCE = null;
  ...

  @Override
  protected void onCreate() {
    ACTIVE_INSTANCE = this;
    super.onCreate();
    ...
  }


  @Override
  protected void onDestroy() {
    ...
    super.onDestroy();
    ACTIVE_INSTANCE = null;
  }

  ...

  public void someMethod() {
    AsyncTask runInBackground = new AsyncTask() {
      protected Result doInBackground (Params... params) {
        ... do your background stuff here ...
      }

      protected void onPostExecute (String result) {
        if (ACTIVE_INSTANCE == null)
          return;
        ...
        ACTIVE_INSTANCE.mMyTextView.setText(result);
        ...
      }
    };
    runInBackground.execute(input);
  }
  ...
  ...
}



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

2. i can't see my samsung galaxy on windows seven 64 bits

J'ai finalement trouv, il fallait que je branche mon tlphone avec
les options stockage de masse et dbuggage dcoch, suite  cela
plusieurs driver s'installent puis ensuite coch le mode dbug, et
installer les drivers modifi!







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

3. packaging multiple APKs

4. Verizon attacks iPhone with new 鈥楧roid鈥?campaign

5. How to find device idle state:

6. Issue with Accelerometer notification when there is higher volume audio play:

7. onTouchEvent in emulator