Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to merge listactivity and actionbaractivity?

Tags:

android

I want to make button share at right corner So i used this. But my project has used extent ListActivity,so how to merge ActionBarActivity and ListActivity?

like image 459
sur yati Avatar asked Jan 27 '26 17:01

sur yati


1 Answers

Change your ListActivity to ActionBarActivity and find ListView e.g:

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

<ListView
    android:id="@+id/list"
    android:layout_height="match_parent"
    android:layout_width="match_parent">
</ListView>

Now for your activity:

public class MyOldListActivity extends ActionBarActivity
{
    private ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView = (ListView) findViewById(R.id.list);
        ....
like image 175
Adeel Ahmad Avatar answered Feb 01 '26 15:02

Adeel Ahmad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!