Search Results

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

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

  • storing data in a database using edit text and button

    - by user1841444
    Hai im trying to Insert data into database using EditText and Button i have created. Im stuck at Activity part of the Code.I unbale to proceed how to write the Onclick action part for Button and EditText part Please help me. Im new to android DBAdapter.java package com.example.database1; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DBAdapter { public static final String KEY_ROWID = "_id"; public static final String KEY_ISBN = "isbn"; public static final String KEY_TITLE = "title"; public static final String KEY_PUBLISHER = "publisher"; private static final String TAG = "DBAdapter"; private static final String DATABASE_NAME = "books"; private static final String DATABASE_TABLE = "titles"; private static final int DATABASE_VERSION = 1; private static final String DATABASE_CREATE = "create table titles (_id integer primary key autoincrement, " + "isbn text not null, title text not null, " + "publisher text not null);"; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DBAdapter(Context ctx) { this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS titles"); onCreate(db); } } //---opens the database--- public DBAdapter open() throws SQLException { db = DBHelper.getWritableDatabase(); return this; } //---closes the database--- public void close() { DBHelper.close(); } //---insert a title into the database--- public long insertTitle(String isbn, String title, String publisher) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ISBN, isbn); initialValues.put(KEY_TITLE, title); initialValues.put(KEY_PUBLISHER, publisher); return db.insert(DATABASE_TABLE, null, initialValues); } //---deletes a particular title--- public boolean deleteTitle(long rowId) { return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0; } //---retrieves all the titles--- public Cursor getAllTitles() { return db.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_ISBN, KEY_TITLE, KEY_PUBLISHER}, null, null, null, null, null); } //---retrieves a particular title--- public Cursor getTitle(long rowId) throws SQLException { Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] { KEY_ROWID, KEY_ISBN, KEY_TITLE, KEY_PUBLISHER }, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } //---updates a title--- public boolean updateTitle(long rowId, String isbn, String title, String publisher) { ContentValues args = new ContentValues(); args.put(KEY_ISBN, isbn); args.put(KEY_TITLE, title); args.put(KEY_PUBLISHER, publisher); return db.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0; } } DatabaseActivity.java package com.example.database1; import android.os.Bundle; import android.app.Activity; import android.database.Cursor; import android.view.Menu; import android.widget.Toast; public class DatabaseActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_database); DBAdapter db=new DBAdapter(this); db.open(); } } activity_database.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/edit1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/edit2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/edit3" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/submit" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Layout does not show up after Activity launch

    - by Peter
    I have an activity which invokes an onItemClick and launches another activity. This activity has a static layout(for testing purposes), but only thing I see is black(I even set the text color to white to check it out). My listener list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { //create new intent Intent item = new Intent(getApplicationContext(), Item.class); // Close all views before launching logged //item.putExtra("name", ((TextView)arg1).getText()); //item.putExtra("uid", user_id); item.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(item); // Close Login Screen onPause(); } }); My activity is here(not much to do it just launches the layout) public class Item extends Activity{ protected SQLiteDatabase myDB=null; protected String name; protected int uid; TextView yeart,year,itemname,comment,commentt,value,valuet,curr,currt; protected void onStart(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.herp); /*name=getIntent().getStringExtra("name"); uid=Integer.parseInt(getIntent().getStringExtra("uid")); itemname=(TextView) findViewById(R.id.itemName);//itemname.setText(name); year=(TextView) findViewById(R.id.itemYear); yeart=(TextView) findViewById(R.id.year); comment=(TextView) findViewById(R.id.itemComments); commentt=(TextView) findViewById(R.id.comments); curr=(TextView) findViewById(R.id.itemcurrent); currt=(TextView) findViewById(R.id.current); value=(TextView) findViewById(R.id.itemValue); valuet=(TextView) findViewById(R.id.value);*/ Database openHelper = new Database(this); myDB = openHelper.getReadableDatabase(); myDB=SQLiteDatabase.openDatabase("data/data/com.example.login2/databases/aeglea", null, SQLiteDatabase.OPEN_READONLY); }} And finally my XML layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/itemName" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" android:gravity="center" android:layout_marginBottom="10px" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#fff" /> <TextView android:id="@+id/current" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Current" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemcurrent" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" /> <TextView android:id="@+id/year" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Year" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemYear" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="asdasd" /> <TextView android:id="@+id/value" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Value" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemValue" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TextView" /> <TextView android:id="@+id/comments" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Comments" android:textSize="20dp" android:textStyle="bold" /> <TextView android:id="@+id/itemComments" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TextView" /> </LinearLayout>

    Read the article

  • Use android.R.layout.simple_list_item_1 with a light theme

    - by Felix
    I have learned that when using android:entries with a ListView, it uses android.R.layout.simple_list_item_1 as the layout for a list item and android.R.id.text1 as the ID of the TextView inside that layout. Please, correct me if I'm wrong. Knowing this, I wanted to create my own adapter but use the same layout resources, in order to provide UI consistency with the platform. Thus, I tried the following: mAdapter = new SimpleCursorAdapter( getApplicationContext(), android.R.layout.simple_list_item_1, mSites, new String[] { SitesDatabase.KEY_SITE }, new int[] { android.R.id.text1 } ); Unfortunately, because I am using a light theme (I have android:theme="@android:style/Theme.Light" in my <application>), the list items appear with white text, making them unreadable. However, when using android:entries to specify a static list of items, the items appear correctly, with black text color. What am I doing wrong? How can I make my dynamic adapter use the standard layout but work with a light theme?

    Read the article

  • Set List View Size Android

    - by Sandeep
    Hello , I am using List View in my project where i have used a xml file which is used to create the list item.Then i have used it programmatically in my class which is extended by ListActivity. But the problem is i have to add a button in the bottom of screen which is not related to list view but List view covers all the screen. So,is there any way to add button in bottom with list view in android. My Code is :- import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; public class Options extends ListActivity { String[] items; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_RIGHT_ICON); items = getResources().getStringArray(R.array.chantOption_array); setListAdapter(new IconicAdapter()); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setBackgroundResource(R.drawable.ichant_logo); setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.icon_t); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // When clicked, show a toast with the TextView text Toast.makeText(getApplicationContext(), items[position], Toast.LENGTH_SHORT).show(); if ("Gayatri Mantra".equals(items[position].toString())) { int[] timeintervals = { 23900, 24000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.gayatri, R.raw.gayatri, R.drawable.icon_gayatri, "Gayatri Mantra", timeintervals); } if ("Om Mani Padme Hum".equals(items[position].toString())) { int[] timeintervals = { 5500, 8200, 11100, 13900, 34100, 36700, 39500, 42300, 59300, 62000, 64800, 67600, 124600 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.ommanipadmehum, R.raw.om_mani, R.drawable.icon_padme, "Om Mani Padme Hum", timeintervals); } if ("Sai Ram".equals(items[position].toString())) { // Audio time interval for bead+total time duration of audio int[] timeintervals = { 4800, 7500, 10400, 12600, 15800, 18600, 21600, 24400, 25000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.sairam, R.raw.sairam, R.drawable.icon_sairam, "Sai Ram", timeintervals); } if ("Aum".equals(items[position].toString())) { // Audio time interval for bead+total time duration of audio int[] timeintervals = { 12850, 13000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.aum, R.raw.aum, R.drawable.ico_aum, "Aum", timeintervals); } } }); } class IconicAdapter extends ArrayAdapter { IconicAdapter() { super(Options.this, R.layout.list_item, items); } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View row = inflater.inflate(R.layout.list_item, parent, false); TextView label = (TextView) row.findViewById(R.id.label); label.setText(" "+items[position]); ImageView icon = (ImageView) row.findViewById(R.id.icon); if (items[position].equals("Gayatri Mantra")) { icon.setImageResource(R.drawable.icon_gayatri); } if (items[position].equals("Om Mani Padme Hum")) { icon.setImageResource(R.drawable.icon_padme); } if (items[position].equals("Sai Ram")) { icon.setImageResource(R.drawable.icon_sairam); } if (items[position].equals("Aum")) { icon.setImageResource(R.drawable.ico_aum); } return (row); } } protected void startChantActivity(int mala_loop, int beads_loop, int background, int media, int titleIcon, String title, int[] timeintervals) { Bundle bundle = new Bundle(); bundle.putInt("mala_loop", mala_loop); bundle.putInt("beads_loop", beads_loop); bundle.putInt("background", background); bundle.putInt("media", media); bundle.putInt("titleIcon", titleIcon); bundle.putString("title", title); bundle.putIntArray("intervals", timeintervals); Intent intent = new Intent(this, ChantBliss.class); intent.putExtras(bundle); startActivityForResult(intent, this.getSelectedItemPosition()); } } And Corresponding xml file is: <?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" android:orientation="horizontal" > <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:paddingLeft="2px" android:paddingRight="2px" android:paddingTop="2px" android:layout_height="wrap_content" /> <TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="22sp" android:textColor="#ff000000" /> </LinearLayout> Thanks in Advance: Sandeep

    Read the article

  • Android ignores scrollbarsize

    - by Maragues
    Hi, I'm trying to modify a ListView scrollbar's width without success <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:choiceMode="singleChoice" android:scrollbars="vertical" android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track" android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb" android:scrollbarSize="4px" android:clickable="true"/> First I tried using a drawable image 4px wide, but the .png was resized. Then I tried using a shape extracted from SamplesApi, without success. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:width="40px"> <gradient android:startColor="#505050" android:endColor="#C0C0C0" android:angle="0"/> <corners android:radius="0dp" /> I've tried with and without the android:width attribute. There's a question on the same topic (http://stackoverflow.com/questions/2565083/width-of-a-scroll-bar-in-android), but it doesn't try anything different that what I'm already trying. As far as I know, creating my own theme shouldn't change the output. There's an example in SamplesApi (Views/ScrollBars). I tried modifying the scrollbarSize attribute without result. I know about ninepatch images, but there's an attribute which should do what I want. Any hint? Thanks in advance.

    Read the article

  • Help with ListView Databse

    - by Weston Dunn
    I am having issues @ run with this code: App Force Closing.. Sprinter.Java import android.app.ListActivity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.widget.ListAdapter; import android.widget.SimpleCursorAdapter; public class Sprinter extends ListActivity { /** Called when the activity is first created. */ final static String MY_DB_NAME = "Sprinter"; final static String MY_DB_TABLE = "Stations"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SQLiteDatabase myDB = null; try { myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null); myDB.execSQL("CREATE TABLE IF NOT EXISTS " + MY_DB_TABLE + "_id integer primary key autoincrement, name varchar(100);"); myDB.execSQL("INSERT INTO " + MY_DB_TABLE + " (_id, name)" + " VALUES ('', 'Oceanside Transit Center');"); myDB.execSQL("INSERT INTO " + MY_DB_TABLE + " (_id, name)" + " VALUES ('', 'Coast Highway');"); Cursor mCursor = myDB.rawQuery("SELECT name" + " FROM " + MY_DB_TABLE, null); startManagingCursor(mCursor); ListAdapter adapter = new SimpleCursorAdapter(this, R.layout.list_item, mCursor, new String[] { "name" }, new int[] { R.id.Name }); this.setListAdapter(adapter); this.getListView().setTextFilterEnabled(true); } finally { if (myDB != null) { myDB.close(); } } } } main.xml <?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" > <ListView android:id="@id/android:list" android:layout_width="wrap_content" android:layout_height="wrap_content"> </ListView> <TextView android:id="@id/android:empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="No Data" /> </LinearLayout> list_item.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:id="@+id/Name" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> </LinearLayout>

    Read the article

  • Andorid: the keyboard appeares when the app is started

    - by Briesanji
    I have coded an Android application composed by a LinearLayout(with an editbox and a button) and a ScrollView(with a LinearLayout that contains a TextView). When the app is started the keyboard pops up immediatly and I don't want this to happen. Have you got some advice?? THIS IS MY LAYOUT : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.b2875.Messaggi$PlaceholderFragment" > <LinearLayout android:layout_width="fill_parent" android:layout_height="70dp" android:layout_marginTop="650dp" > <EditText android:id="@+id/ScriviMessaggio" android:layout_width="332dp" android:layout_height="71dp" android:ems="10" android:hint="@string/scriviMessaggio" /> <Button android:id="@+id/invia" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/invia" /> </LinearLayout> <ScrollView android:id="@+id/scrollView1" android:scrollbarAlwaysDrawVerticalTrack="true" android:layout_width="fill_parent" android:layout_height="600dp" android:focusable="true" android:focusableInTouchMode="true" > <LinearLayout android:id="@+id/linearVertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/AreaMessaggi" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/messaggi" /> </LinearLayout> </ScrollView> </RelativeLayout> MY MANIFEST IS THIS: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.b2875" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:windowSoftInputMode="stateHidden" android:name="com.example.b2875.Messaggi" 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> </manifest>

    Read the article

  • Media query from a specific folder

    - by sensei
    I would like to understand how I can use a cursor to jpg files in a folder specified in the sdcard. I'm trying to select with a cursor the jpg files in a specific folder, and I tried this: This is the code: public static Uri getRandomImage(ContentResolver resolver) { String[] projection = new String[] { BaseColumns._ID, }; String folder = "/sdcard/DCIM/Wallpaper/"; folder = folder + "%"; Uri uri = Media.EXTERNAL_CONTENT_URI; String[] whereArgs = new String[]{folder}; Cursor cursor = resolver.query(uri, projection, null, whereArgs, MediaColumns._ID); if (cursor == null || cursor.getCount() <= 0) { return null; } cursor.moveToPosition(new Random().nextInt(cursor.getCount())); return Uri.withAppendedPath(uri, cursor.getString(0)); } but this code gives me error here is the logcat: E/AndroidRuntime(11986): FATAL EXCEPTION: main E/AndroidRuntime(11986): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x26a490 E/AndroidRuntime(11986): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:158) E/AndroidRuntime(11986): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114) E/AndroidRuntime(11986): at android.content.ContentProviderProxy.bulkQueryInternal(ContentProviderNative.java:330) E/AndroidRuntime(11986): at android.content.ContentProviderProxy.query(ContentProviderNative.java:366) E/AndroidRuntime(11986): at android.content.ContentResolver.query(ContentResolver.java:245) E/AndroidRuntime(11986): at it.bisemanuDEV.slidepuzzle.SelectImagePreference.getRandomImage(SelectImagePreference.java:126) E/AndroidRuntime(11986): at it.bisemanuDEV.slidepuzzle.TileView.newGame(TileView.java:156) E/AndroidRuntime(11986): at it.bisemanuDEV.slidepuzzle.SlidePuzzleActivity.onOptionsItemSelected(SlidePuzzleActivity.java:377) E/AndroidRuntime(11986): at android.app.Activity.onMenuItemSelected(Activity.java:2762) E/AndroidRuntime(11986): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730) E/AndroidRuntime(11986): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) E/AndroidRuntime(11986): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) E/AndroidRuntime(11986): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532) E/AndroidRuntime(11986): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122) E/AndroidRuntime(11986): at android.view.View$PerformClick.run(View.java:8819) E/AndroidRuntime(11986): at android.os.Handler.handleCallback(Handler.java:603) E/AndroidRuntime(11986): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime(11986): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime(11986): at android.app.ActivityThread.main(ActivityThread.java:4627) E/AndroidRuntime(11986): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(11986): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime(11986): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) E/AndroidRuntime(11986): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) E/AndroidRuntime(11986): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • 2 fundamental questions for the Androgurus ...Can someone guide me

    - by Saul Carpenter
    I have'nt plunged into Android Development as yet though Java Classes C++ all that is not new to me. Here are the questions folks. Appreciated any help on these : - If I need to develop test and deploy Android Apps do I NEED AN ANDROID Hardware device or is there a software Android Simulator like VMWARE or Virtual PC , where I can emulate the results.If there is such can you point me more info I have a Netbook ( the Chinese Ipad Clone ) running Android that has only Wi-Fi for the present. Is it possible to add the following features via the spare USB Port --- a USB Based 56K Modem : Are there Android platform H/W Drivers. --- a USB based RJ45 ( Ethernet LAN LandLine connection ) Adapter :Are there Android platform H/W Drivers. Please advise Thanks Saul

    Read the article

  • html textfield in WebView in an Android application is hidden by the soft keyboard

    - by user280503
    Hello, I have an Android application that is a TabHost with a WebView. I use it to load a specific html file that has a text field in its bottom part. When I touch the html textfield, the soft keyboard pops up, and hides the textfield, so that I cannot see what I have typed. Here is the layout: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TabWidget android:focusableInTouchMode="false" android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="63dp" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" /> </LinearLayout> </FrameLayout> </LinearLayout> </TabHost> I have tried to configure the AndroidManifest.xml file with android:windowSoftInputMode="adjustResize" with no success. I have also tried replacing the FrameLayout in my layout with ScollView, but that caused my webview to increase in size indefinitely when the application is running.. this may be due to some javascript I have running on the page. I have noticed that the android's web browser has a nifty behaviour - in a web page, after the soft keyboard pops up, the web page scrolls smoothly so that the focusable textfield is visible to the user. How can I have this kind of behavior in my applicaiton?

    Read the article

  • Android fragments problems different layouts

    - by juan
    I have two layouts: one for portait with one container and another for landscape with two containers. In the first layout I show a fragment and when the user select one element, I replace the fragment with another (with FragmentTransation.Replace). <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/container1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" /> </RelativeLayout> In the second layout I want to show the two fragments at one time, one in the first container and the second in the second container. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <LinearLayout android:id="@+id/container1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" android:orientation="vertical" /> <LinearLayout android:id="@+id/container2" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="7" android:orientation="vertical" /> </LinearLayout> But I can't make this works with configuration changes. I try use different names for containers, try add fragments when only bundle is null,... Someone have a working code of this case?

    Read the article

  • android.view.InflateException: Binary XML file line #11

    - by kostas
    i have a listview with some items.when the user touch the first list item it starts a dialog activity with a photo and some text below.that happens for every list item.but unfortunately i m getting this android.view.InflateException: Binary XML file line #11 force down error..this is a part of my manifest: <activity android:name=".kalamaki" android:label="Beaches in Chania" android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog" /> this is my .xml file: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#cfcfcc" > <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_marginTop="5px" android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@+id/image" /> <TextView android:layout_marginTop="5px" android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/text" android:textColor="#262626" /> </LinearLayout> </ScrollView> and this is my logcat error: 04-30 19:08:34.433: ERROR/AndroidRuntime(405): Uncaught handler: thread main exiting due to uncaught exception 04-30 19:08:34.463: ERROR/AndroidRuntime(405): java.lang.RuntimeException: Unable to start activity ComponentInfo{kostas.menu.chania/kostas.menu.chania.sfinari}: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown> 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2454) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.os.Handler.dispatchMessage(Handler.java:99) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.os.Looper.loop(Looper.java:123) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread.main(ActivityThread.java:4310) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at java.lang.reflect.Method.invokeNative(Native Method) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at java.lang.reflect.Method.invoke(Method.java:521) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at dalvik.system.NativeStart.main(Native Method) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown> 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.Activity.setContentView(Activity.java:1622) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at kostas.menu.chania.sfinari.onCreate(sfinari.java:15) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): ... 11 more 04-30 19:08:34.463: ERROR/AndroidRuntime(405): Caused by: java.lang.reflect.InvocationTargetException 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.widget.ImageView.<init>(ImageView.java:105) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at java.lang.reflect.Constructor.constructNative(Native Method) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.view.LayoutInflater.createView(LayoutInflater.java:500) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): ... 23 more 04-30 19:08:34.463: ERROR/AndroidRuntime(405): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/scrollbar_handle_vertical.9.png from drawable resource ID #0x7f050000 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.content.res.Resources.loadDrawable(Resources.java:1710) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.widget.ImageView.<init>(ImageView.java:115) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): ... 27 more 04-30 19:08:34.463: ERROR/AndroidRuntime(405): Caused by: java.io.FileNotFoundException: res/drawable-mdpi/scrollbar_handle_vertical.9.png 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.content.res.AssetManager.openNonAssetNative(Native Method) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.content.res.AssetManager.openNonAsset(AssetManager.java:391) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): at android.content.res.Resources.loadDrawable(Resources.java:1702) 04-30 19:08:34.463: ERROR/AndroidRuntime(405): ... 29 more

    Read the article

  • WPF - ListView within listView Scrollbar problem

    - by Josh
    So I currently have a ListView "List A" who's items each have an expander control which contains another ListView "List B". The problem I am having is that sometimes List B grows so big that it extends beyond the range of List A's view area. List A's scroll bars do not pick up the fact that parts of List B are not being displayed. Is there a way to setup my xaml so that the scroll bars for List A will detect when the list inside the expander is longer then the viewing area of List A. Here is the section of code I need to modify: <TabItem Header="Finished"> <TabItem.Resources> <ResourceDictionary> <DataTemplate x:Key="EpisodeItem"> <DockPanel Margin="30,3"> <TextBlock Text="{Binding Title}" DockPanel.Dock="Left" /> <WrapPanel Margin="10,0" DockPanel.Dock="Right"> <TextBlock Text="Finished at: " /> <TextBlock Text="{Binding TimeAdded}" /> </WrapPanel> </DockPanel> </DataTemplate> <DataTemplate x:Key="AnimeItem"> <DockPanel Margin="5,10"> <Image Height="75" Width="Auto" Source="{Binding ImagePath}" DockPanel.Dock="Left" VerticalAlignment="Top"/> <Expander Template="{StaticResource AnimeExpanderControlTemplate}" > <Expander.Header> <TextBlock FontWeight="Bold" Text="{Binding AnimeTitle}" /> </Expander.Header> <ListView ItemsSource="{Binding Episodes}" ItemTemplate="{StaticResource EpisodeItem}" BorderThickness="0,0,0,0" /> </Expander> </DockPanel> </DataTemplate> </ResourceDictionary> </TabItem.Resources> <ListView Name="finishedView" ItemsSource="{Binding UploadedAnime, diagnostics:PresentationTraceSources.TraceLevel=High}" ItemTemplate="{StaticResource AnimeItem}" /> </TabItem> List A is the ListView with name "finishedView" and List B is the ListView with ItemSource "Episodes"

    Read the article

  • android layout images bad quality

    - by user1028269
    when I add images on layout it show in bad quality <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/sbackground" /> how to fix it? (I need to fix it only without programmatically) thanks

    Read the article

  • PagerView overlapping PagerTabStrip / PagerTitleStrip

    - by user1256169
    I've been trying for about a week to get my PagerView not to overlap the TitleStrip. I've tried absolutely everything I can think of, and one StackOverflow question that looked like the same question, had an answer that wasn't applicable. It appears that both the PagerTitleStrip and the TextView start at 0,0 (left,top) Any help would be appreciated. Note that I can't use any XML (inc Layout.xml) so it's all done programatically. Here's a full working example of my problem: package com.example.projname; import android.app.Activity; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerTabStrip; import android.support.v4.view.ViewPager; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.TextView; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyPagerAdapter myPagerAdapter = new MyPagerAdapter(); PagerTabStrip myPagerTabStrip = new PagerTabStrip(this); myPagerTabStrip.setGravity(Gravity.TOP); ViewPager viewPager = new ViewPager(this); viewPager.addView(myPagerTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); viewPager.setAdapter(myPagerAdapter); setContentView(viewPager); } class MyPagerAdapter extends PagerAdapter { public final String[] Titles = { "Title One", "Title Two", "Title Three", "Title Four", "Title Five" }; @Override public int getCount() { return Titles.length; } @Override public boolean isViewFromObject(View view, Object object) { return (view == object); } @Override public CharSequence getPageTitle(int position) { return Titles[position]; } @Override public Object instantiateItem(ViewGroup container, int position) { TextView textView = new TextView(getApplicationContext()); String myString = new String("Page " + (position + 1) + "\r\n"); textView.setText(myString + myString + myString + myString + myString + myString); container.addView(textView); return textView; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } } } Edit: Adding a screenshot of the problem:

    Read the article

  • Android: Context menu doesn't show up for ListView with members defined by LinearLayout?

    - by RandomEngy
    I've got a ListActivity and ListView and I've bound some data to it. The data shows up fine, and I've also registered a context menu for the view. When I display the list items as just a simple TextView, it works fine: <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/nametext" android:layout_width="wrap_content" android:layout_height="wrap_content"/> However when I try something a bit more complex, like show the name and a CheckBox, the menu never shows up: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/nametext" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <CheckBox android:id="@+id/namecheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> Can long-presses work on more complex elements? I'm building on 2.1.

    Read the article

  • Filtered ListView not updated

    - by Anton
    Hi! I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter of Type Artist. Artist is a very small class that has a name and an id. The Artist Class has toString() overridden to return just the name. I have an EditText. The EditText has an TextChangeListener where i call .getFilter().filter(chars, callback) on my adapter. In the Filter.Filterlistener().onComplete() callback i print the count and it looks really good. As i type the count decreases. So it seams everything works as advertised, but the List stays the same. I tried to call artistAdapter.notifyDataSetChanged() to force the list to redraw, but nothing happens. [see 2.)] I am tinkering around for days now! I am desperate.. Hopefully someone can have a look on my code and tell me what i am doing wrong! Thanks! Here is what i have done: 1.) Defined a ListView and an EditText like this: <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_search_text" android:layout_width="fill_parent" android:layout_height="35dip" android:layout_below="@id/header"> </EditText> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_search" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ListView> 2.) Setup my ListView in the Activities onCreate(): private ListView listView = null; private ArtistAdapter artistAdapter = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search_artists); artistAdapter = new ArtistAdapter(this, R.layout.row, list); // 'list' is an ArrayList<Artist> listView = (ListView) findViewById(R.id.list_search); listView.setAdapter(artistAdapter); listView.setFastScrollEnabled(true); listView.setTextFilterEnabled(true); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> av, View v, int position, long id) { // do something } }); EditText txtSearch = (EditText) findViewById(R.id.list_search_text); txtSearch.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable arg0) { } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence chars, int start, int before, int count) { artistAdapter.getFilter().filter(chars, new Filter.FilterListener() { public void onFilterComplete(int count) { Log.d(Config.LOG_TAG, "filter complete! count: " + count); artistAdapter.notifyDataSetChanged(); } }); } }); } 3.) This is my ArtistAdapter in short. I added an remove() and add() method: public class ArtistAdapter extends ArrayAdapter<Artist> implements SectionIndexer { private List<Artist> items; /* other stuff like overridden getView, getPositionForSection, getSectionForPosition and so on */ @Override public void remove(Artist object) { super.remove(object); items.remove(object); } @Override public void add(Artist object) { super.add(object); items.add(object); } } 4.) My artist has also the toString() overridden: public class Artist implements Comparable<Artist> { public String uid; public String name; public Artist(String id, String name) { this.uid = id; this.name = name; } public int compareTo(Artist another) { return this.name.compareToIgnoreCase(another.name); } @Override public String toString() { return this.name; } }

    Read the article

  • handling various frame layouts in android

    - by vaibhav
    i'm new to game development and am trying create a Contra or the old tmnt game (but a simple one) like game for android. for the game i decided to divide my main screen in three parts - upper for stats,mid for the game and lower for controls. my main.xml is <?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" > <FrameLayout android:id="@+id/upper_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > </FrameLayout> <FrameLayout android:id="@+id/fl" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.5" > </FrameLayout> <FrameLayout android:id="@+id/low_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.85" > </FrameLayout> </LinearLayout> so i have created the gameview and gameloopthread classes for the mid surface(which is pretty standard). my problem is that how do i draw in the upper and lower frame layouts? should i make new classes for view and thread for each layout , should i do all this in the gameview class itself or is there any better way to implement this?

    Read the article

  • imageview weights in linearlayout

    - by Metalex
    I have this layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" android:minWidth="100dp" > <TextView android:id="@+id/txt_what_way" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="4" android:textAppearance="?android:attr/textAppearanceMedium" /> <LinearLayout android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="3"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:scaleType="fitCenter" android:src="@drawable/ic_launcher"/> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="3"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:scaleType="fitCenter" android:src="@drawable/ic_launcher"/> </LinearLayout> </LinearLayout> I want that it looks like: TextView - 40% of width, Layout with ImageView - 30% of widht, Layout with ImageView - 30% of width. But the output is: TextViewImageViewImageView----------------free space---------------------------------- Thanks for your help! -- EDITED Done it in programmatic way

    Read the article

  • Why is 1px sometimes 2px when specified in Android XML?

    - by Daniel Lew
    I've got a desire for a one-pixel divider line, just for looks. I thought I could accomplish this using a View of height 1px, with a defined background. However, I'm getting some very odd behavior on different devices - sometimes the 1px ends up as 2px. Take this sample layout for example: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> </LinearLayout> When run on my G1, this comes out fine. But on the Nexus One, it alternates between 1px lines and 2px lines. Does anyone know where this is going awry? Why does Android sometimes make 1px into 2px?

    Read the article

  • How do I place widgets above and below a listview?

    - by Jay Askren
    I have a list view and want to put stuff both above(on the y axis) and below(y axis) it including images, text views, and a row of buttons. Below is a simplified version of what I am creating. Unfortunately the list covers(i.e. above on the z axis) the header so the header text is not visible instead of being underneath (on the y axis) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/footer" android:text="footer" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentBottom="true" /> <ListView android:id="@+id/list_view" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_above="@id/footer" android:background="#ff9999ff"/> <TextView android:id="@+id/header" android:text="header" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentTop="true" android:layout_above="@id/list_view" android:baselineAlignBottom="false" /> </RelativeLayout> Here is the corresponding Activity class: public class SampleListActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity); } }

    Read the article

  • Logcat error: "addView(View, LayoutParams) is not supported in AdapterView" in a ListView

    - by HacKreatorz
    I'm doing an aplication for Android and something I need is that it shows a list of all files and directories in the SD Card and it has to be able to move through the different directories. I found a good tutorial in anddev: http://bit.ly/h4GyFC I modified a few things so the aplication moves in the SD Card and not in Android root Directories but the rest is mostly the same. This is my xml file for the activity: <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /> </ListView> And this is the code for the Activity: import hackreatorz.cifrador.R; import java.io.File; import java.util.ArrayList; import android.app.ListActivity; import android.content.res.Configuration; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class ArchivosSD extends ListActivity { private ArrayList<String> directoryEntries = new ArrayList<String>(); private File currentDirectory = new File("/sdcard/"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); browseToSD(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } private void browseToSD() { browseTo(new File("/sdcard/")); } private void upOneLevel() { if(this.currentDirectory.getParent() != null) this.browseTo(this.currentDirectory.getParentFile()); } private void browseTo(final File directory) { if (directory.isDirectory()) { this.currentDirectory = directory; fill(directory.listFiles()); } else { Toast.makeText(ArchivosSD.this, this.directoryEntries.get(this.getSelectedItemPosition()), Toast.LENGTH_SHORT).show(); } } private void fill(File[] files) { this.directoryEntries.clear(); this.directoryEntries.add(getString(R.string.current_dir)); if(this.currentDirectory.getParent() != null) this.directoryEntries.add(getString(R.string.up_one_level)); int currentPathStringLength = (int) this.currentDirectory.getAbsoluteFile().length(); for (File file : files) { this.directoryEntries.add(file.getAbsolutePath().substring(currentPathStringLength)); } setListAdapter(new ArrayAdapter<String>(this, R.layout.archivos_sd, this.directoryEntries)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { int selectionRowID = (int) this.getSelectedItemPosition(); String selectedFileString = this.directoryEntries.get(selectionRowID); if (selectedFileString.equals(".")) { this.browseToSD(); } else if(selectedFileString.equals("..")) { this.upOneLevel(); } else { File clickedFile = null; clickedFile = new File(this.currentDirectory.getAbsolutePath() + this.directoryEntries.get(selectionRowID)); if(clickedFile != null) this.browseTo(clickedFile); } } } I don't get any errores in Eclipse, but I get a Force Close when running the aplication on my phone and when I look at Logcat I see the following: 01-01 23:30:29.858: ERROR/AndroidRuntime(14911): FATAL EXCEPTION: main *01-01 23:30:29.858: ERROR/AndroidRuntime(14911): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView* I don't have a clue what to do, I've looked up in Google and I didn't find anything and I did the same at stackoverflow. This is my first aplication in Java and for Android so I'm a real n00b and if the answer was there, I didn't understand it so I would really apreciate if you could explain what I should do to fix this error and why. Thanks for everything in advanced.

    Read the article

  • What is wrong with this layout? Android

    - by kellogs
    Hi, I am trying to accomplish a view like this: left side = live camera preview, right side = a column of 4 images. But all that I managed with the following xml was a fullscreen live camera preview. Android 1.5 emulator. Thanks <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <proto.wiinkme.SurfaceViewEx android:id="@+id/preview" android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:layout_weight="3"/> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_toRightOf="@+id/preview" android:layout_alignParentRight="true" android:layout_weight="1"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mother_earth" android:src="@drawable/mother_earth_show" /> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/meadow" android:src="@drawable/meadow_show" /> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/trap" android:src="@drawable/trap_show" /> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/whistle" android:src="@drawable/whistle_show" /> </LinearLayout> </RelativeLayout>

    Read the article

  • Android custom xml widget

    - by DrogoNevets
    I have an XML file in my layout folder that has how i want my custom widget/view (not sure what correct terminology is here). but how do i make it so that i can programatically, add one or more to an activity the xml file is as follows <?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="wrap_content" android:id="@+id/viewLog"> <TextView android:id="@+id/viewLogClimbName" android:layout_width="fill_parent" android:singleLine="true" android:ellipsize="end" android:gravity="left" /> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/viewLogDate" android:layout_width="fill_parent" android:singleLine="true" android:ellipsize="end" android:gravity="left" /> <TextView android:id="@+id/viewLogStyle" android:layout_width="fill_parent" android:singleLine="true" android:ellipsize="end" android:gravity="left" /> </LinearLayout> <TextView android:id="@+id/viewLogDetails" android:layout_width="fill_parent" android:layout_height="fill_parent" android:ellipsize="end" android:gravity="left" android:layout_weight="1" /> </LinearLayout> </LinearLayout> I have looked at the android how-to and dont really understand what its getting at

    Read the article

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