2011-09-01 14 views
-1

是否可以將我的列表視圖的內容設置爲其他活動。將ListView內容設置爲其他活動

就像我在這裏用我的tabhost-content完成的。

 package de.retowaelchli.filterit; 

    import android.app.TabActivity; 
    import android.os.Bundle; 
    import android.widget.TabHost; 
    import android.content.Intent; 

    public class StatsActivity extends TabActivity { 
     /** Called when the activity is first created. */ 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.stats); 
      TabHost tabHost = getTabHost();  

      tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("Smiley Filter").setContent(new Intent(this, SFilterStatsActivity.class))); 
      tabHost.setCurrentTab(1); 

      tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("Auto Delete").setContent(new Intent(this, ADFilterStatsActivity.class))); 

     }  
} 

所以,我只是想將我的ListView的內容設置爲其他Activity。這是可能的,我已經是我該怎麼做? Thx提前!

問候 野生動物園

一些更多的信息來了解,我想知道,在這個活動:

package de.retowaelchli.filterit; 


import android.app.Activity; 
import android.content.Intent; 
import android.os.Bundle; 
import android.view.View; 


public class ADeleteActivity extends Activity { 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.autodelete); 


    } 
    /** Verweise auf die anderen Seiten **/ 
    public void onClickADConfig(View view){ 
     final Intent i = new Intent(this, ADFilterConfigActivity.class); 
     startActivity(i); } 
} 

這裏的佈局是:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:weightSum="1"> 


    <ListView android:id="@+id/AutoDeleteFilterListe" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.97"> 
    </ListView> 


     <TableLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/ADOverviewMainsite" 
      android:layout_weight="0.03"> 

       <TableRow 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"   
        android:id="@+id/ADFilterOverview" 
        android:onClick="onClickADConfig" 
        android:layout_weight="0.03"> 
         <TextView 

          android:text="@string/newadfilter" 
          style="@style/NormalFont" /> 
       </TableRow> 
    </TableLayout> 

</LinearLayout> 

我在此活動中需要將我的Listview的內容設置爲其他.class。我希望你們明白我的意思。 :=)

+1

對不起,你能更準確地說明你想做什麼嗎?你想要在標籤主機的子活動或其他東西里面有一個listview?謝謝。 –

+0

我只想將我的ListView的內容設置爲其他活動。如果是的話,那可能嗎?我該怎麼做? – safari

+0

此活動是選項卡活動的子項,對嗎?在這種情況下,您可以在此子活動的onCreate()方法中設置listview。 –

回答

-1

我發現不可能將ListView的內容設置爲其他活動。 Greetz safari

相關問題