Tables Fragment impementation

This commit is contained in:
Przemek Grondek 2014-07-14 15:18:03 +02:00
parent a3c1f87f15
commit b9176a3881
2 changed files with 24 additions and 6 deletions

View file

@ -5,19 +5,38 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
/**
* Created by nerull7 on 14.07.14.
*/
public class TableFragment extends Fragment{
public class TableFragment extends Fragment implements AdapterView.OnItemClickListener {
String databaseName;
ListView tablesList;
ListAdapter listAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_table, container, false);
TextView text = (TextView) rootView.findViewById(R.id.dumbText);
text.setText(getArguments().getString("DatabaseName"));
databaseName = getArguments().getString("DatabaseName");
tablesList = (ListView) rootView.findViewById(R.id.tableList);
setupList();
return rootView;
}
private void setupList(){
listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getTables());
tablesList.setAdapter(listAdapter);
tablesList.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
}
}

View file

@ -8,10 +8,9 @@
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="info.nerull7.mysqlbrowser.TableFragment">
<TextView
android:text="@string/hello_world"
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dumbText"/>
android:id="@+id/tableList" />
</RelativeLayout>