Search Results

Search found 12175 results on 487 pages for 'android listview'.

Page 7/487 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • DatePicker on android

    - by SWE
    I have a problem in DatePicker on android I can't make it smaller than default size This is the XML code which used: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <DatePicker android:id="@+id/datePicker1" android:layout_width="70dp" android:layout_height="40dp" android:layout_alignParentLeft="true" android:layout_below="@+id/addevent_location" /> </RelativeLayout> Any help please

    Read the article

  • Getting an Android App to Show Up in the market for "Sony Internet TV"(Google TV)

    - by user1291659
    I'm having a bit of trouble getting my app to show up in the market under GoogleTV. I've searched google's official documentation and I don't believe the manifest lists any elements which would invalidate the program; the only hardware requirement specified is landscape mode, wakelock and external storage(neither which should cause it to be filtered for GTV according to the documentation) and I set the uses touchscreen elements "required" attribute to false. below is the AndroidManifest.xml for my project: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.whateversoft" android:versionCode="2" android:versionName="0.1" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="Color Shafted" android:theme="@style/Theme.NoBackground" android:debuggable="false"> <activity android:label="Color Shafted" android:name=".colorshafted.ColorShafted" android:configChanges = "keyboard|keyboardHidden|orientation" android:screenOrientation = "landscape"> <!-- Set as the default run activity --> <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="Color Shafted Settings" android:name=".colorshafted.Settings" android:theme="@android:style/Theme" android:configChanges = "keyboard|keyboardHidden"> <!-- --> </activity> </application> <!-- DEFINE PERMISSIONS FOR CAPABILITIES --> <uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name = "android.permission.WAKE_LOCK"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <!-- END OF PERMISSIONS FOR CAPABILITIES --> </manifest> I'm about to start promoting the app after the next major release so its been kind of a bummer since I can't seem to get this to work. Any help would be appreciated, thanks in advance : )

    Read the article

  • How to Implement the ImageAdapter for this listView Code?

    - by iDroid Explorer
    Code of Lost View is like: public final static String ITEM_TITLE = "title"; public final static String ITEM_CAPTION = "caption"; public Resources resources; public static Uri path; public static File file; public static ProgressDialog m_progressDialog; public static ListView list; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); // create our list and custom adapter SeparatedListAdapter adapter = new SeparatedListAdapter(this); adapter.addSection("Local documents:", new ArrayAdapter<String>(this, R.layout.list_item, new String[] { "WindowsONE Mobile PK", "WindowsorONE Moldings","Filet for a burger video" })); adapter.addSection("Non-local resources:", new ArrayAdapter<String>(this, R.layout.list_item, new String[] { "Launch Photo slideshow link", "Dealer locator link" })); adapter.addSection("Send emails:", new ArrayAdapter<String>(this, R.layout.list_item, new String[] { "Send Dealer Locator email", "Send Catalog email","Send install instrucation link" })); //For extra Information in Listview //adapter.addSection("Non-local resources:", new SimpleAdapter(this, security, R.layout.list_complex, //new String[] { ITEM_TITLE, ITEM_CAPTION }, new int[] { R.id.list_complex_title, R.id.list_complex_caption })); list = getListView(); list.setAdapter(adapter); list.setTextFilterEnabled(true); list.setOnItemClickListener(this); } }

    Read the article

  • How can I set drawable to a ListView in android

    - by sxingfeng
    I am writing a app for android 1.5. I want to use a complex listview to display my data. I want to show a ImageView of a drawable object in my List item. I learned from a demo: ------> listData.put("Img", listData.put("Img", R.drawable.XXX)); listData.put("Time", "100"); listItems.add(listData); It can display correctly, however, I want to change Img at runtime, The image maybe generated at run-time, so I change the code as follow, but it falls. Can anyone help me ? many thanks! protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.item_list); itemListView = (ListView) findViewById(R.id.listview); ArrayList<HashMap<String, Object>> listItems = new ArrayList<HashMap<String, Object>>(); for(int i = 0;i <XXX.size(); ++i) { HashMap<String, Object> listData = new HashMap<String, Object>(); ---------> 1) listData.put("Img", new Drawable(XXX)); 2) listData.put("Time", "100"); 3) listItems.add(listData); } SimpleAdapter listItemAdapter = new SimpleAdapter(this, listItems, R.layout.listitem, new String[] { "Img", "Time"}, new int[] { R.id.listitem_img, R.id.listitem_time }); itemListView.setAdapter(listItemAdapter); listitem.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:paddingBottom="4dip" android:paddingLeft="12dip" android:paddingRight="12dip"> <ImageView android:paddingTop="12dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/listitem_img" /> <TextView android:layout_height="wrap_content" android:textSize="20dip" android:layout_width="wrap_content" android:id="@+id/listitem_time" /> </LinearLayout>

    Read the article

  • Hello-World-grade landscape Android app fails to start (complete code included)

    - by WingedCat
    I'm trying to develop a simple Android app, fixed in landscape mode. I am using Eclipse 1.3, compiling for Android SDK version 7 (OS version 2.1). When I try to run it in the emulator, it crashes on boot. (It gets as far as the unlock slider, but shortly after that when trying to launch the application itself, I get "The application Failtest (process com.wcs.failtest) has stopped unexpectedly. Please try again.".) Here is main.xml (with the tags escaped so this displays properly): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="480px" android:layout_height="320px" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="96px" android:layout_height="320px" android:id="@+id/action_menu" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="96px" android:layout_height="48px" > <Button android:layout_width="48px" android:layout_height="48px" android:background="#f00" android:id="@+id/action_button_11" /> </LinearLayout> </LinearLayout> </LinearLayout> Here is AndroidManifest.xml (again with the tags escaped so this displays properly): <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wcs.failtest" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <activity android:name=".FailtestActivity" android:screenOrientation="landscape" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="7" /> </manifest> And here is FailtestActivity.java: package com.wcs.failtest; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.view.View.OnClickListener; import android.view.View; public class FailtestActivity extends Activity { private OnClickListener action11Listener = new OnClickListener() { public void onClick(View v) { } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button button; button = (Button)findViewById(R.id.action_button_11); button.setOnClickListener(action11Listener); setContentView(R.layout.main); } } I suspect it is something simple I'm overlooking. What is it?

    Read the article

  • Multiple apks, single listing of app for Google TV and Android Phone/Tablet

    - by Yash
    I have an Android phone/tablet apk which is currently in Play store and has these settings in its manifest file: package="com.company.xyz" android:versionCode="0803010008" android:versionName="01.00.08" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-library android:name="com.adobe.flashplayer" android:required="true" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" android:xlargeScreens="true" /> <uses-feature android:name="android.hardware.touchscreen" android:required="true" /> I had uploaded another apk for GoogleTV which has the same package name com.company.xyz as the previous apk and has the following settings in its manifest file: package="com.company.xyz" android:versionCode="1203010001" android:versionName="01.00.01" > <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature android:name="com.google.android.tv" android:required="true" /> <supports-screens android:largeScreens="true"/> <uses-configuration android:reqFiveWayNav="true" /> The Google TV apk never showed up on Play Store on GTV boxes, so I updated its manifest with the settings below and with everything else remaining the same package="com.company.xyz" android:versionCode="1203010002" android:versionName="01.00.02" > <supports-screens android:largeScreens="true" android:normalScreens="false" android:smallScreens="false" android:xlargeScreens="false" /> At this point, I am unable to save the app because of the Play Store error "Error: New APK version is lower than previous APK version" even though the GoogleTV apk has a higher version code than the Phone/Tablet version. Does anyone have a solution for this? Thanks!

    Read the article

  • Program crashes when item selected from listView

    - by philip
    The application just crash every time I try to click from the list. ListMovingNames.java public class ListMovingNames extends Activity { ListView MoveList; SQLHandler SQLHandlerview; Cursor cursor; Button addMove; EditText etAddMove; TextView temp; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.selectorcreatemove); addMove = (Button) findViewById(R.id.bAddMove); etAddMove = (EditText) findViewById(R.id.etMoveName); temp = (TextView) findViewById(R.id.tvTemp); MoveList = (ListView) findViewById(R.id.lvMoveItems); SQLHandlerview = new SQLHandler(this); SQLHandlerview = new SQLHandler(ListMovingNames.this); SQLHandlerview.open(); cursor = SQLHandlerview.getMove(); startManagingCursor(cursor); String[] from = new String[]{SQLHandler.KEY_MOVENAME}; int[] to = new int[]{R.id.text}; SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to); MoveList.setAdapter(cursorAdapter); SQLHandlerview.close(); addMove.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub try { String ssmoveName = etAddMove.getText().toString(); SQLHandler entry = new SQLHandler(ListMovingNames.this); entry.open(); entry.createMove(ssmoveName); entry.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); MoveList.setOnItemClickListener(new OnItemClickListener() { @SuppressLint("ShowToast") public void onItemClick(AdapterView<?> arg0, View view, int position, long id) { // TODO Auto-generated method stub // String moveset = cursor.getString(position); // temp.setText(moveset); Toast.makeText(ListMovingNames.this, position, Toast.LENGTH_SHORT); } }); } } and here's my database handler. But I'm sure that there's nothing wrong with it, its probably the cursor adapter. SQLHandler.java public class SQLHandler { public static final String KEY_ROOMMOVEHOLDER = "roommoveholder"; public static final String KEY_ROOM = "room"; public static final String KEY_ITEMMOVEHOLDER = "itemmoveholder"; public static final String KEY_ITEMNAME = "itemname"; public static final String KEY_ITEMVALUE = "itemvalue"; public static final String KEY_ROOMHOLDER = "roomholder"; public static final String KEY_MOVENAME = "movename"; public static final String KEY_ID1 = "_id"; public static final String KEY_ID2 = "_id"; public static final String KEY_ID3 = "_id"; public static final String KEY_ID4 = "_id"; public static final String KEY_MOVEDATE = "movedate"; private static final String DATABASE_NAME = "mymovingfriend"; private static final int DATABASE_VERSION = 1; public static final String KEY_SORTANDPURGE = "sortandpurge"; public static final String KEY_RESEARCH = "research"; public static final String KEY_CREATEMOVINGBINDER = "createmovingbinder"; public static final String KEY_ORDERSUPPLIES = "ordersupplies"; public static final String KEY_USEITORLOSEIT = "useitorloseit"; public static final String KEY_TAKEMEASUREMENTS = "takemeasurements"; public static final String KEY_CHOOSEMOVER = "choosemover"; public static final String KEY_BEGINPACKING = "beginpacking"; public static final String KEY_LABEL = "label"; public static final String KEY_SEPARATEVALUES = "separatevalues"; public static final String KEY_DOACHANGEOFADDRESS = "doachangeofaddress"; public static final String KEY_NOTIFYIMPORTANTPARTIES = "notifyimportantparties"; private static final String DATABASE_TABLE1 = "movingname"; private static final String DATABASE_TABLE2 = "movingrooms"; private static final String DATABASE_TABLE3 = "movingitems"; private static final String DATABASE_TABLE4 = "todolist"; public static final String CREATE_TABLE_1 = "CREATE TABLE " + DATABASE_TABLE1 + " (" + KEY_ID1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_MOVEDATE + " TEXT NOT NULL, " + KEY_MOVENAME + " TEXT NOT NULL);"; public static final String CREATE_TABLE_2 = "CREATE TABLE " + DATABASE_TABLE2 + " (" + KEY_ID2 + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_ROOMMOVEHOLDER + " TEXT NOT NULL, " + KEY_ROOM + " TEXT NOT NULL);"; public static final String CREATE_TABLE_3 = "CREATE TABLE " + DATABASE_TABLE3 + " (" + KEY_ID3 + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_ITEMNAME + " TEXT NOT NULL, " + KEY_ITEMVALUE + " TEXT NOT NULL, " + KEY_ROOMHOLDER + " TEXT NOT NULL, " + KEY_ITEMMOVEHOLDER + " TEXT NOT NULL);"; public static final String CREATE_TABLE_4 = "CREATE TABLE " + DATABASE_TABLE4 + " (" + KEY_ID4 + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_SORTANDPURGE + " TEXT NOT NULL, " + KEY_RESEARCH + " INTEGER NOT NULL, " + KEY_CREATEMOVINGBINDER + " TEXT NOT NULL, " + KEY_ORDERSUPPLIES + " TEXT NOT NULL, " + KEY_USEITORLOSEIT + " TEXT NOT NULL, " + KEY_TAKEMEASUREMENTS + " TEXT NOT NULL, " + KEY_CHOOSEMOVER + " TEXT NOT NULL, " + KEY_BEGINPACKING + " TEXT NOT NULL, " + KEY_LABEL + " TEXT NOT NULL, " + KEY_SEPARATEVALUES + " TEXT NOT NULL, " + KEY_DOACHANGEOFADDRESS + " TEXT NOT NULL, " + KEY_NOTIFYIMPORTANTPARTIES + " TEXT NOT NULL);"; private DbHelper ourHelper; private final Context ourContext; private SQLiteDatabase ourDatabase; private static class DbHelper extends SQLiteOpenHelper{ public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(CREATE_TABLE_1); db.execSQL(CREATE_TABLE_2); db.execSQL(CREATE_TABLE_3); db.execSQL(CREATE_TABLE_4); } @Override public void onUpgrade(SQLiteDatabase db, int oldversion, int newversion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE1); db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE2); db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE3); db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE4); onCreate(db); } } public SQLHandler(Context c){ ourContext = c; } public SQLHandler open() throws SQLException{ ourHelper = new DbHelper(ourContext); ourDatabase = ourHelper.getWritableDatabase(); return this; } public void close(){ ourHelper.close(); } public long createMove(String smovename){ ContentValues cv = new ContentValues(); cv.put(KEY_MOVENAME, smovename); cv.put(KEY_MOVEDATE, "Not yet set"); return ourDatabase.insert(DATABASE_TABLE1, null, cv); } public long addRooms(String sroommoveholder, String sroom){ ContentValues cv = new ContentValues(); cv.put(KEY_ROOMMOVEHOLDER, sroommoveholder); cv.put(KEY_ROOM, sroom); return ourDatabase.insert(DATABASE_TABLE2, null, cv); } public long addItems(String sitemmoveholder, String sroomholder, String sitemname, String sitemvalue){ ContentValues cv = new ContentValues(); cv.put(KEY_ITEMMOVEHOLDER, sitemmoveholder); cv.put(KEY_ROOMHOLDER, sroomholder); cv.put(KEY_ITEMNAME, sitemname); cv.put(KEY_ITEMVALUE, sitemvalue); return ourDatabase.insert(DATABASE_TABLE3, null, cv); } public long todoList(String todoitem){ ContentValues cv = new ContentValues(); cv.put(todoitem, "Done"); return ourDatabase.insert(DATABASE_TABLE4, null, cv); } public Cursor getMove(){ String[] columns = new String[]{KEY_ID1, KEY_MOVENAME}; Cursor cursor = ourDatabase.query(DATABASE_TABLE1, columns, null, null, null, null, null); return cursor; } } can anyone point out what I'm doing wrong? here's the log 09-19 03:22:36.596: E/AndroidRuntime(679): FATAL EXCEPTION: main 09-19 03:22:36.596: E/AndroidRuntime(679): android.content.res.Resources$NotFoundException: String resource ID #0x0 09-19 03:22:36.596: E/AndroidRuntime(679): at android.content.res.Resources.getText(Resources.java:201) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.widget.Toast.makeText(Toast.java:258) 09-19 03:22:36.596: E/AndroidRuntime(679): at standard.internet.marketing.mymovingfriend.ListMovingNames$2.onItemClick(ListMovingNames.java:78) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.widget.ListView.performItemClick(ListView.java:3382) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.os.Handler.handleCallback(Handler.java:587) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:92) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:123) 09-19 03:22:36.596: E/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:4627) 09-19 03:22:36.596: E/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method) 09-19 03:22:36.596: E/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:521) 09-19 03:22:36.596: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 09-19 03:22:36.596: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 09-19 03:22:36.596: E/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • Using AsyncTask to display data in ListView, but onPostExecute not being called

    - by sumisu
    I made a simple AsyncTask class to display data in ListView with the help of this stackoverflow question. But the AsyncTask onPostExecute is not being called. This is my code: public class Start extends SherlockActivity { // JSON Node names private static final String TAG_ID = "id"; private static final String TAG_NAME = "name"; // category JSONArray JSONArray category = null; private ListView lv; @Override public void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); setContentView(R.layout.test); new MyAsyncTask().execute("http://...."); // Launching new screen on Selecting Single ListItem lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem String name = ((TextView) view.findViewById(R.id.name)).getText().toString(); String cost = ((TextView) view.findViewById(R.id.mail)).getText().toString(); // Starting new intent Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class); in.putExtra("categoryname", name); System.out.println(cost); in.putExtra("categoryid", cost); startActivity(in); } }); } public class MyAsyncTask extends AsyncTask<String, Void, ArrayList<HashMap<String, String>> > { // Hashmap for ListView ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>(); @Override protected ArrayList<HashMap<String, String>> doInBackground(String... params) { // Creating JSON Parser instance JSONParser jParser = new JSONParser(); // getting JSON string from URL category = jParser.getJSONArrayFromUrl(params[0]); try { // looping through All Contacts for(int i = 0; i < category.length(); i++){ JSONObject c = category.getJSONObject(i); // Storing each json item in variable String id = c.getString(TAG_ID); String name = c.getString(TAG_NAME); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_ID, id); map.put(TAG_NAME, name); // adding HashList to ArrayList contactList.add(map); } } catch (JSONException e) { Log.e("log_tag", "Error parsing data "+e.toString()); } return contactList; } @Override protected void onPostExecute(ArrayList<HashMap<String, String>> result) { ListAdapter adapter = new SimpleAdapter(Start.this, result , R.layout.list_item, new String[] { TAG_NAME, TAG_ID }, new int[] { R.id.name, R.id.mail }); // selecting single ListView item lv = (ListView) findViewById(R.id.ListView); lv.setAdapter(adapter); } } } Eclipse: 11-25 11:40:31.896: E/AndroidRuntime(917): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.essentials/de.main.Start}: java.lang.NullPointerException

    Read the article

  • Databinding a ListView with Mono for Android

    - by Wallym
    The world lives on data. Data is all around us and in many forms: salespeople need to know what customers have spent; twitter users want to know what their friends are saying. How do we as developers present data to a user? In Android, we use the ListView in its various forms. In this article, we'll look at using a ListView, how we can work with it, then discuss what we need to do to overcome some of the challenges in a mobile environment.Article url: http://visualstudiomagazine.com/articles/2012/09/14/databind-a-listview.aspx

    Read the article

  • Android: Dynamically change Image in Listview

    - by Vivek
    Hi All, I have a listview defined by the following xml. I need to toggle the image in the list during runtime when the user clicks on any row. How can I achieve this? Any help is highly appreciated. Thanks //list_item.xml <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:id="@+id/img" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:id="@+id/txt" /> </LinearLayout>

    Read the article

  • getItemIdAtPosition() problem in Android?

    - by Praveen Chandrasekaran
    I am using the getItemIdAtPosition() to get the Basecoulmns id of the record in Sqlite Database. the code is below: protected void onListItemClick(ListView l, View v, int position, long id) { Cursor cursor = managedQuery(Constants.CONTENT_URI, PROJECTION, BaseColumns._ID + "=" + l.getItemIdAtPosition(position), null, null); } But its does not retrieves the id correctly. Is this method depends some thing at the time of setting adapter or creation of DB? I have no idea. why it shows the position of the listview. Any Idea?

    Read the article

  • Empty text view message when listview is empty

    - by Blid Tounsi
    I have a ListView with an empty list catch in the XML and it works fine. How to toggle ListView Empty Text please ? This is my XML code : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/empty" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/emptyList" /> <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> I'm not using a ListActivity. It s possible to do that please ?

    Read the article

  • ListView in Android, handler for clicking item

    - by eljainc
    Hello, I have an activity in Android which uses a ListView. When I click on an item in the ListView, I would like to be able to determine which item was clicked. I have the following code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.listr); //setupDB(); // populateList3(); ListView lv = (ListView) findViewById(R.id.ListView01); lv.setClickable(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(ListRecords.this,"Clicked!", Toast.LENGTH_LONG).show(); } }); } My XML code: xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Linear03lr" android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center" android:layout_height="fill_parent"> android:layout_width="wrap_content" android:layout_height="400dp" / <Button android:id="@+id/previousbutton" android:gravity="center_horizontal" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:text="Previous Menu"/> </LinearLayout> What am I missing here to be able to intercept clicks on the Listview? Thanks

    Read the article

  • ListView getting deleted onbackpress

    - by adohertyd
    I have a listview in my mainactivity that makes a call to a database to populate it. When an item on the listview is clicked it starts a new activity showing the details of the item that was clicked. When the back button is pressed the listview is not displayed again. What could be the problem? This is the entirety of my mainactivity: public class MainActivity extends ListActivity { Button bAddMod; private ModuleDB db; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new ModuleDB(this); db.open(); fillList(); db.close(); bAddMod = (Button) findViewById(R.id.btnAddMod); bAddMod.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(MainActivity.this, AddModule.class); startActivity(i); } }); } private void fillList() { ListView lv = getListView(); Cursor curs = db.getData(); startManagingCursor(curs); MyCursorAdapter adapter = new MyCursorAdapter(getApplicationContext(), curs); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id){ Intent k = new Intent(MainActivity.this, ModuleDetails.class); k.putExtra("mod_id", id); startActivity(k); } }); } }

    Read the article

  • Android -- autoLink

    - by Ryan
    Is there any way to Linkify a specific TextView that is contained within a ListView? I tried using android:autoLink="all" but that didn't work. I was getting an out of context error. Important also to note: the ListView is my second view in the ViewFlipper. I have also tried: View mItemView = mAdapter.getView(2, null, null); TextView infoText = (TextView) mItemView.findViewById(R.id.rowText2); Linkify.addLinks(infoText, Linkify.ALL); Right after the adapter was bound to the ListView and the View was switched. No luck. Here is the stack trace: 06-03 21:19:25.180: ERROR/AndroidRuntime(1214): Uncaught handler: thread main exiting due to uncaught exception 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.app.ApplicationContext.startActivity(ApplicationContext.java:550) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.content.ContextWrapper.startActivity(ContextWrapper.java:248) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.text.style.URLSpan.onClick(URLSpan.java:62) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.text.method.LinkMovementMethod.onTouchEvent(LinkMovementMethod.java:216) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.widget.TextView.onTouchEvent(TextView.java:6560) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.View.dispatchTouchEvent(View.java:3709) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.os.Handler.dispatchMessage(Handler.java:99) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.os.Looper.loop(Looper.java:123) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at android.app.ActivityThread.main(ActivityThread.java:4363) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at java.lang.reflect.Method.invokeNative(Native Method) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at java.lang.reflect.Method.invoke(Method.java:521) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 06-03 21:19:25.219: ERROR/AndroidRuntime(1214): at dalvik.system.NativeStart.main(Native Method) Any Ideas? Thanks in advance!!!

    Read the article

  • TextBox Inside TabHost isn't clickable

    - by agam360
    Here is my code:(main.xml -layout) <TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" > </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <MultiAutoCompleteTextView android:id="@+id/txtCode" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.25" android:capitalize="none" android:focusable="true" android:focusableInTouchMode="false" android:gravity="top|left" android:text="@string/strtxtCode" android:textSize="26dp" android:textStyle="bold" android:typeface="normal" /> <MultiAutoCompleteTextView android:id="@+id/txtCodeHTML" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.25" android:capitalize="none" android:focusable="true" android:focusableInTouchMode="false" android:gravity="top|left" android:text="@string/strtxtCode2" android:textSize="26dp" android:textStyle="bold" android:typeface="normal" /> </FrameLayout> </LinearLayout> </TabHost> When I try to click(touch) the text-box, it does nothing. What should I do in order to fix this?

    Read the article

  • RadioGroup does not appear ?

    - by Mina Samy
    Hi all I have a linear layout with this form <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RadioGroup android:id="@+id/group" android:layout_width="wrap_content" android:layout_height="wrap_content"> <RadioButton android:id="@+id/item1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item1" android:checked="true" /> <RadioButton android:id="@+id/item2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item2" /> <RadioButton android:id="@+id/item3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item3" /> </RadioGroup> <TextView android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> this works fine but if I put the TextView above the RadioGroup like this <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <RadioGroup android:id="@+id/group" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioButton android:id="@+id/item1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item1" android:checked="true" /> <RadioButton android:id="@+id/item2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item2" /> <RadioButton android:id="@+id/item3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Item3" /> </RadioGroup> </LinearLayout> the activity appears blank what can be the reason for this thanks

    Read the article

  • Custom title of PreferenceActivity (problem)

    - by Emerald214
    I have the same problem like this question: Custom title bar in PreferenceActivity ?? After extending PreferenceActivity, I write this code in onCreate(), it just shows a blank grey title. I think it is a bug (because this solution works well with Activity). requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title); super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.main_pref); Edited: window_title.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:background="@color/titleBar" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingLeft="5dip" android:paddingRight="5dip"> <ImageView android:id="@+id/imageView1" android:src="@drawable/megadict_icon" android:layout_height="35dip" android:layout_width="35dip" android:layout_gravity="center_vertical"> </ImageView> <TextView android:layout_width="wrap_content" android:id="@+id/textView1" android:layout_height="wrap_content" android:textColor="@color/white" android:textSize="16dip" android:layout_weight="1" android:layout_gravity="center_vertical" android:text="@string/appName" android:paddingLeft="5dip" android:paddingRight="5dip"> </TextView> <ProgressBar style="?android:attr/progressBarStyleSmall" android:id="@+id/progressBar" android:layout_width="28dip" android:layout_height="28dip" android:layout_gravity="center_vertical" android:visibility="invisible"> </ProgressBar> </LinearLayout> main_pref.xml <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/mainPrefTitle"> <ListPreference android:entries="@array/languageStrings" android:entryValues="@array/languageValues" android:dialogTitle="@string/languagePrefTitle" android:title="@string/mainPrefTitle" android:key="languagePrefKey"> </ListPreference> </PreferenceScreen>

    Read the article

  • How do I vertically align an item within a list using relative layout?

    - by Jay Askren
    I am using a list view in Android 1.5 to show a list of images and text next to the image. I am trying to vertically center the text but the text is at the top of the row instead of centered. Below is my layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dip"> <ImageView android:id="@+id/item_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingRight="10dip" android:src="@drawable/default_image" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_centerVertical="true" android:gravity="center_vertical"/> <TextView android:id="@+id/item_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/item_image" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_centerVertical="true" android:gravity="center_vertical" /> </RelativeLayout> It seems strange that I need to set alignParentTop="true" when I'm trying to vertically center the text, but if I don't the text does not even show up. What am I doing wrong?

    Read the article

  • Android ListView in Activity

    - by Dev.Android
    My layout is like this Title Layout Listview BottomLayout. I have an 150 item which i have custom layout which i want to add in listview. So my main problem is i want to add slowly slowly one by one that customlayouts in listview. So whenever the first screen is displayed i want load 10 items from server and add it to listview.then onscroll down i want to load the remaining 10 items from 150 cutom layouts. So how can I do this activity?

    Read the article

  • Listview of items from a object selected in another listview

    - by Ingó Vals
    Ok the title maybe a little confusing. I have a database with the table Companies wich has one-to-many relotionship with another table Divisions ( so each company can have many divisions ) and division will have many employees. I have a ListView of the companies. What I wan't is that when I choose a company from the ListView another ListView of divisions within that company appears below it. Then I pick a division and another listview of employees within that division appaers below that. You get the picture. Is there anyway to do this mostly inside the XAML code declaritively (sp?). I'm using linq so the Company entity objects have a property named Division wich if I understand linq correctly should include Division objects of the divisions connected to the company. So after getting all the companies and putting them as a itemsource to CompanyListView this is where I currently am. <ListView x:Name="CompanyListView" DisplayMemberPath="CompanyName" Grid.Row="0" Grid.Column="0" /> <ListView DataContext="{Binding ElementName=CompanyListView, Path=SelectedItem}" DisplayMemberPath="Division.DivisionName" Grid.Row="1" Grid.Column="0" /> I know I'm way off but I was hoping by putting something specific in the DataContext and DisplayMemberPath I could get this to work. If not then I have to capture the Id of the company I guess and capture a select event or something. Another issue but related is the in the seconde column besides the lisview I wan't to have a details/edit view for the selected item. So when only a company is selected details about that will appear then when a division under the company is picked It will go there instead, any ideas?

    Read the article

  • Get checked Listitems from ListView and pass that to another activity

    - by Rajesh Rajaram
    I'm developing a Androidapplication using ListView. ListView have a one file in each and every ListItem. Here, I have set onItemClickin ListView. So, that if user clicks the ListItememail application gets open and attach the particular file in email. Its for the single File, this gets implemented and working fine. Now I want attach the multiple file in email. i.e. the implementing the CheckBoxin each ListItemand checked items have to attached into the Mail. I know its possible because its very similar to the file manager application that checking the multiple file and deleting the all file by clicking the single Button. But don't know how to do.

    Read the article

  • How to show empty view when ListView is empty?

    - by Sheehan Alam
    Here is my layout. For some reason the empty view (TextView in this case) always appears, even when the List is not empty. I thought the ListView would automatically detect when to show the empty view. How can I hook up the empty view properly? <RelativeLayout android:id="@+id/LinearLayoutAR" android:layout_height="fill_parent" android:layout_width="fill_parent"> <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ARListView"></ListView> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/arProgressBar" android:layout_centerHorizontal="true" android:layout_centerVertical="true"></ProgressBar> <!-- Here is the view to show if the list is emtpy --> <TextView android:id="@id/android:empty" android:layout_width="match_parent" android:layout_height="match_parent" android:text="No Results" /> </RelativeLayout>

    Read the article

  • Android 4 Fragments with Mono for Android

    - by Wallym
    With the release of Android 3.0, Google added support for larger displays and attention-grabbing UI designs and layouts. On a tablet screen, UI components can be used to present better information. How does Android do this? It has a technology called Fragments, and I'll look at its implementation in the currently shipping operating system, Android 4. (Let's get past all the jokes about Android and fragmentation on its device platform.)For more information on this, check out my article at Visual Studio Magazine - http://visualstudiomagazine.com/articles/2012/12/13/android-4-and-fragments.aspx

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >