• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Enquire in ListView for SQLite

I have been trying to solve the problem but I still cant find a solution.
Please give me some hints to help me... Many thanks

The following is my code:

In the view.xml (This file is used to view the database record)

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >

<ListView android:id="@+id/List"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:smoothScrollbar="true"
android:isScrollContainer="true"/>

<TextView android:id="@+id/tvSQLinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="55dip"
android:text="@string/no_record"/>
</LinearLayout>

import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.ArrayAdapter;

public class List extends Activity {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sqlview);

HotOrNot info = new HotOrNot(this);
info.open();
String data = info.getData();
info.close();

ArrayList<String> results = new ArrayList<String>();
results.addAll( Arrays.asList(data) );
ListView listView = (ListView) findViewById(R.id.List);
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, results));
}}

In a menu file, one of the button function:

case R.id.bSQLOpenView:
Intent intent = new Intent(getApplicationContext(), SQLView.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);

Intent a = new Intent(getApplicationContext(), List.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(a);
break;

I have tried several ways to solve it in the List.java
like... using ListActivity

Please advise...

Thanks a lot
 
Back
Top Bottom