wie Sie wissen, wenn die Ansicht hat sich aufgeblasen mit dem onFinishInflate

Ich möchte wissen, Wann meine TabActivity hat aufgeblasen, so habe ich versucht diesen code

 @Override
 protected void onFinishInflate() {
     super.onFinishInflate();
 }

bekomme ich die Fehlermeldung: must override or implement a supertype method

Ich kann nicht verstehen, warum das nicht funktioniert in der TabActivity.

Kann Jemand explane diese?

package com.carlsberg.bungle.history;

import com.carlsberg.bungle.Consts;
import com.carlsberg.bungle.R;
import android.app.TabActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

public class TabActivityHistoryLauncher extends TabActivity {

    private final String TAG = "TabActivityHistoryLauncher";    
    private TabHost tabHost;
    MyListener myListener;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.tab_activity_history);

        tabHost = (TabHost) findViewById(android.R.id.tabhost);

        Intent int2 = new Intent(this, ActivityTabGroup2.class);
        Intent int1 = new Intent(this, ActivityTabGroup1.class);

        tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);//Divider .9.png 
        setupTab(new TextView(this), getString(R.string.string_incoming),int1);
        setupTab(new TextView(this), getString(R.string.string_outgoing),int2);

        myListener = new MyListener();
        Intent intent = getIntent();

        if(intent != null){
            Bundle extras = intent.getExtras();
            if(extras != null){
                String outgoing = extras.getString(Consts.SWITSH_TO_OUTGOING);
                String incoming = extras.getString(Consts.SWITSH_TO_INCOMING);
                if(incoming != null){
                    tabHost.setCurrentTab(0);
                }else if(outgoing != null){
                    tabHost.setCurrentTab(1);
                }
            }
        }

    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

    }


    private void setupTab(final View view, final String tag, Intent int1) {
        View tabview = createTabView(tabHost.getContext(), tag);

        TabSpec setContent = tabHost.newTabSpec(tag).setIndicator(tabview).setContent(int1);

        tabHost.addTab(setContent);
    }

    private static View createTabView(final Context context, final String text) {
        View view = LayoutInflater.from(context).inflate(R.layout.tab_history_a_tab, null);
        TextView tv = (TextView) view.findViewById(R.id.tabsText);
        tv.setText(text);
        return view;
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if(intent != null){
            Bundle extras = intent.getExtras();
            if(extras != null){
                String outgoing = extras.getString(Consts.SWITSH_TO_OUTGOING);
                String incoming = extras.getString(Consts.SWITSH_TO_INCOMING);
                if(incoming != null){
                    tabHost.setCurrentTab(0);
                }else if(outgoing != null){
                    tabHost.setCurrentTab(1);
                }
            }
        }

    }   


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (myListener != null) {
            unregisterReceiver(myListener);
        }   
    }
    @Override
    protected void onResume() {
        super.onResume();
        Log.d(TAG, "onResume ***********************************************************************"); 
        IntentFilter intentFilterInStart = new IntentFilter(Consts.COM_CARLSBERG_INCOMINGSTATUS_ACTION_START );
        IntentFilter intentFilterOutStart = new IntentFilter(Consts.COM_CARLSBERG_OUTGOINGSTATUS_ACTION_START );        
        registerReceiver(myListener, intentFilterInStart);
        registerReceiver(myListener, intentFilterOutStart);     
        //MyListenerIsRegistered = true;        

    }
    @Override
    protected void onPause() {
        super.onPause();
        Log.d(TAG, "onResume ***********************************************************************");

    }

    //Nested 'listener'
    protected class MyListener extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {

            if (intent.getAction().equals(Consts.COM_CARLSBERG_INCOMINGSTATUS_ACTION_START)) {
                tabHost.setCurrentTab(0);
            }
            if (intent.getAction().equals(Consts.COM_CARLSBERG_OUTGOINGSTATUS_ACTION_START)) {
                tabHost.setCurrentTab(1);
            }           
        }
    }

}
InformationsquelleAutor Erik | 2011-11-13
Schreibe einen Kommentar