SDK 2.0: wrong behaviour after convertion from SDK1.6 - please help!

by Evgeny V » Sun, 29 Nov 2009 01:22:31 GMT


Sponsored Links
 Hi!

I got infinit loop when trying to run activity which creating dialog.
Before I'm pressing the dialog button OK or Cancel button the system is
startong my tab main activity again.
It worked fine in all previouse versions.
 The log report:
*11-28 16:59:38.607: WARN/UsageStats(59): Something wrong here, didn't
expect evgeny.converter to be resumed
11-28 17:12:06.498: ERROR/WindowManager(269): android.view.WindowLeaked:
Activity evgeny.converter.TabMain has leaked window
com.android.internal.policy.impl.phonewindow$decorv...@43cfd4f0 that was
originally added here
*
Thanks in advance,
Evgeny

The code is as following:
Launcher code:
  SharedPreferences _State;
     @Override
     protected void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);

         final TabHost tabHost = getTabHost();

         tabHost.addTab(tabHost.newTabSpec("tabMeasures")
                 .setIndicator(res.getString(R.string.tab_measures_title),
                 res.getDrawable(R.drawable.measures_tab_32))
                 .setContent(new Intent(this, MeasuresMain.class)));

         tabHost.addTab(tabHost.newTabSpec("tabClothes")
                 .setIndicator(res.getString(R.string.tab_clothes_title),
                 res.getDrawable(R.drawable.clothes_tab_40))
                 .setContent(new Intent(this, ClothesMain.class)));
         tabHost.addTab(tabHost.newTabSpec("tabSettings")
                 .setIndicator(res.getString(R.string.tab_settings_title),
                 res.getDrawable(R.drawable.settings_tab_40))
                 .setContent(new Intent(this,
ConverterViewSettings.class)));

         tabHost.setBackgroundResource(R.drawable.background_main);

         _State = getSharedPreferences("Settings", MODE_WORLD_READABLE |
MODE_WORLD_WRITEABLE );
         if(_State.getBoolean(ConverterUtil.EVG_IS_SHOW_LICENSE_AGREEMENT,
true))
          showDialog(1);

     }

@Override
     protected Dialog onCreateDialog(int id)
     {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setPositiveButton(R.string.lblButtonAgree, new
DialogInterface.OnClickListener()
      {
       public void onClick(DialogInterface dialog, int whichButton)
       {
              try
              {
               SharedPreferences.Editor editor = _State.edit();

editor.putBoolean(ConverterUtil.EVG_IS_SHOW_LICENSE_AGREEMENT, false);
               editor.commit();
              }
              catch (Exception e)
              {
         e.printStackTrace();
        }
       }
      });
      builder.setNegativeButton(R.string.lblButtonExit, new
DialogInterface.OnClickListener()
      {
       public void onClick(DialogInterface dialog, int whichButton)
       {
        finish();
       }
      });

      LayoutInflater inflater = LayoutInflater.from(this);
            builder.setTitle(R.string.lblLicenseCaption);
            builder.setIcon(R.drawable.my_converter_32);
      ScrollView layout = (ScrollView) inflater.inflate(R.layout.about,
null);

  
((TextView)layout.findViewById(R.id.txtAbout)).setText(R.string.lblLicenseText);

  
((TextView)layout.findViewById(R.id.txtMyEmail)).setVisibility(LinearLayout.GONE);
      builder.setView(layout);
      return builder.create();
     }

--



Other Threads

1. developing the android xmpp cleint

hi android group,


I'm developing the android XMPPClient,the one to one chat is success
in android using smack api.
 i have two doubts

1)how to reuse connection class through the project
2)how to retrieve the the groups existing in the openfire server.
3)how to retrieve chat history from mysql db

pls answer to any question asap

very necessary


thanks in advance

-- 

2. application widget and switching orientation...

I have a samsung tablet.

I have a test widget.

When I change orientation the widget disappears, but is actually still
there (I can long press to remove it).

in my res directory, I have

res\drawable
res\drawable-hdpi
res\drawable-ldpi
res\drawable-mdpi
res\layout
res\layout-land
res\layout-large-land

With valid values in all of these areas, but the widget just will not
appear when I go into landscape mode.

Ideas?

tia

TestWidgetProvider.java
----
package com.test.widget;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class TestWidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds) {
        super.onUpdate(context, appWidgetManager, appWidgetIds);

        final int N = appWidgetIds.length;

        // Perform this loop procedure for each App Widget that
belongs to this provider
        for (int i=0; i<N; i++) {
            int appWidgetId = appWidgetIds[i];

            Intent intent = new Intent(context, TestWidget.class);
            PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent, 0);

            // Get the layout for the App Widget and attach an on-
click listener to the button
            RemoteViews views = new
RemoteViews(context.getPackageName(), R.layout.appwidget);
            views.setOnClickPendingIntent(R.id.StartupIdleView,
pendingIntent);
            views.setOnClickPendingIntent(R.id.StartupLogo,
pendingIntent);

            // Tell the AppWidgetManager to perform an update on the
current App Widget
            appWidgetManager.updateAppWidget(appWidgetId, views);
        }
    }

    @Override
    public void onDeleted(Context context, int[] appWidgetIds) {
        super.onDeleted(context, appWidgetIds);
    }

    @Override
    public void onEnabled(Context context) {
        super.onEnabled(context);
    }

    @Override
    public void onDisabled(Context context) {
        super.onDisabled(context);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        // taken from:
        // 

3. Create rows and columns at runtime

4. Tutorial to start developing Graphic EQ in C or C++

5. Detecting CB Radio Signals with Android Phones

6. Preferred method to open the Image Gallery? My previous implemention no longer works

7. Android Books