Search Results

Search found 22 results on 1 pages for 'soclose'.

Page 1/1 | 1 

  • Android ListView with SQLite

    - by soclose
    Hi I'd like to refresh the Listview items. These items are populated from SQLite database. My code is below public class Weeve extends Activity { private String[] lv_arr; protected ListView CView; private DBAdapter mDbHelper; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new DBAdapter(this); mDbHelper.open(); Cursor c = mDbHelper.getAll(); if (c.getCount() > 0) {if (c.moveToFirst()) { ArrayList strings = new ArrayList(); do { String mC = c.getString(0); strings.add(mC); } while (c.moveToNext()); lv_arr = (String[]) strings.toArray(new String[strings.size()]); } } else Toast.makeText(this, "No more Records", Toast.LENGTH_SHORT).show(); c.close(); ListView CView = new ListView(this); CView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lv_arr)); setContentView(CView);}} I'd like to make refreshing this list view after adding, updating or deleting SQLite table. These operations are called by content or option menu. I tried to create these code into a separated function and call it after every operation. But can't. I think setContentView(CView) statement. I also tried to use SimpleCursorAdapter like notepad sample from Android.com. I got Thread error. Help me.

    Read the article

  • Autocomplettextview filtered by input keys

    - by soclose
    Hi I use autocompletetextview with SimpleCursorAdapter to get data from sqlite. I'd like to get its drop down list started by the entered key. In my autocompletetextview, the list is not shown or filtered by input text. eg, If user enter "an", all text started with "an" will be seen in this list. In Java public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new); txtPNo = (AutoCompleteTextView) findViewById(R.id.txtSTo); mDbHelper = new DBAdapter(this); mDbHelper.open(); SimpleCursorAdapter notes = fillToData(); txtPhoneNo.setAdapter(notes); } private SimpleCursorAdapter fillToData() { Cursor c = mDbHelper.getName(); startManagingCursor(c); String[] from = new String[] {DBAdapter.Name,DBAdapter.No1}; int[] to = new int[] {R.id.txtName,R.id.txtNo1}; Log.d(TAG, "cursor.getCount()=" + c.getCount()); SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.autocomplete, c, from, to); return notes; } In new.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#ffffff" > <AutoCompleteTextView android:id="@+id/txtSTo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:textColor="#000000" android:hint="To" android:completionThreshold="1" android:selectAllOnFocus="true" android:layout_alignParentTop = "true" android:layout_alignParentLeft="true"/> </RelativeLayout> In autocomplete.xml <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0" android:padding="5dp"> <TableRow android:padding="5dp"> <LinearLayout android:orientation="vertical"> <TextView android:id="@+id/txtName" xmlns:android="http://schemas.android.com/apk/res/android" android:textColor="#000000" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/txtNo1" xmlns:android="http://schemas.android.com/apk/res/android" android:textColor="#000000" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </TableRow> </TableLayout> How to implement to get just filtered list?

    Read the article

  • passing table id

    - by soclose
    Hi In Android, I make a list view that describe the name fields from a table in SQLite. Clicking long-term on any List Item, context menu appears and then I wanna get the ID of that item (I mean in the table, there are ID and name fields) and pass this ID to next layout. Why I wanna pass this ID is to update this record in SQLite table. Here the next layout will be tablelayout. how to pass any value from one layout to another? how to code?

    Read the article

  • AlertDialog Input Text

    - by soclose
    Hi, I'd like to use AlertDialog as a pin code or password dialog. Here is my code - AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Login"); alert.setMessage("Enter Pin :"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); Log.d( TAG, "Pin Value : " + value); return; } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub return; } }); alert.show(); How to code that all input text will appear like ' * '

    Read the article

  • Android Application Icon Change

    - by soclose
    Hi, Is it possible to change the android application icon at run time? I've read through Changing the application icon text dynamically in Android and How can i change an application icon programmatically in Android?. All answered can't. I use Android 1.6. Is there any way?

    Read the article

  • Add Dynamic ListView Row

    - by soclose
    Hi, I could intercept ContentObserver changes at any time. In these time, I'd like to add a dynamic listview row with or without opening my application but i don't know how to implement it. Please share me some hints. Thank you.

    Read the article

  • secure from unauthorised access

    - by soclose
    Hi, Based on the user requirements, he wants to use our android application via pin code access like login whenever he starts to use this application. In Android or any mobile, most of the applications start again the last using layout. so which event should i call this login alertdialog to access each time users start to use it? Or let me know the better. Thank you.

    Read the article

  • SQLite table query

    - by soclose
    Hi I query the table by using this function below public Cursor getTableInfo() throws SQLException { return db.query(TableName, null, null, null, null, null, null); } I got the error "View Root.handleMessage(Message)line:1704". I could insert the data but can't query the data. I called this function below Cursor c = db.getTableInfo(); int cRow = c.getCount(); if (cRow == 0) { Toast.makeText(NewContact.this, "No Record", Toast.LENGTH_LONG).show(); } Please help me.

    Read the article

  • KeyCode_Enter to next edittext

    - by soclose
    Hi, In edittext, after typing 'Enter' key, system make a new line inside it. I'd like to focus on next edittext, no new line. how to code? my code in xml is below <EditText android:id="@+id/txtNPCode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:layout_alignLeft="@+id/lblNPCode" android:layout_below="@+id/lblNPCode" android:layout_centerHorizontal="true" /> <EditText android:id="@+id/txtCNPCode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:layout_alignLeft="@+id/lblCNPCode" android:layout_below="@+id/lblCNPCode" android:layout_centerHorizontal="true" /> I also caputer key code in setOnKeyListener tCNPCode.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if(keyCode == 66) { Toast.makeText(S_PCode.this, "Enter Key", Toast.LENGTH_LONG).show(); //tNPCode.setFocusable(true); } return false; } });

    Read the article

  • don't wanna lose data on Android after uninstalling

    - by soclose
    Hi, Now I make a trial application. I'd like to store IMEI and other info in Android permanently. And I don't want to lose them after uninstalling it. I tested with shared preference but it deletes after un-installation. SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("silentMode", true); // Commit the edits! editor.commit(); let me know where to store.

    Read the article

  • Android Contacts

    - by soclose
    Hi I'm .NET Developer, but I'm new in Android. I'd like to test to add a feature. It is appeared clicking Menu under Contacts in Android. It includes New Contact, Search, Display Group and Import Contacts. I just only wanna get "New Contact". How could I test it? Which API do I need to use? Best Regards

    Read the article

  • how to get count column

    - by soclose
    Hi I'd like to get the value of Count column from cursor. public Cursor getRCount(String iplace) throws SQLException { try { String strSql = "SELECT COUNT(_id) AS RCount FROM tbName WHERE place= '" + iplace + "'"; return db.rawQuery(strSql, null); } catch (SQLException e) { Log.e("Exception on query", e.toString()); return null; } } I tried to get this count column value from cursor like below Cursor cR = mDbHelper.getRCount(cplace);if (cR.getCount() > 0){long lCount = cR.getLong(0);}cR.close();} I got the debug error. How to get it?

    Read the article

  • Output Parameter in java

    - by soclose
    Hi, could u give me a sample code of using output parameter in function? I tried to google it but just found it in function. I'd like to use this output value in another function. I will use this code in Android.

    Read the article

  • some fields of "content//sms/"

    - by soclose
    Hi, I query "content//sms/" and don't know what some fields are. They are - Thread ID Protocol Status Reply_Path_Present Service_Center I check them in LogCat. I find them like below Thread ID : 1 to 6 etc.. Protocol : null / 0 Status : -1 Reply_Path_Present : null / 0 Service_Center : null Please tell me what they are.

    Read the article

  • Autocomplettextview

    - by soclose
    Hi, In my autocompletetextview, the list is not shown or filtered by input text. Eg, If user enter "an", all text started with "an" will be seen in this list. How to fix this?

    Read the article

  • SMS Address Format

    - by soclose
    Hi, I'd like to discuss about different SMS Address Formats. In built-in contact of Motorola Milestone, phone no is saved as 914-383-46 I'd like to know that only "-" is included in any phone no format? Other characters possible? like "/", "space", etc... PS: I've just only used Nokia 6210 and Motorola Milestone. So let me know other phones' format.

    Read the article

1