Search Results

Search found 25798 results on 1032 pages for 'android xml'.

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

  • How do I style buttons in a LinearLayout like a ListView

    - by Mannaz
    I have a vertically orientated LinearLayout with some Buttons in it: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt1" android:text="Button 1"></Button> <Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt2" android:text="Button 2"></Button> <Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt3" android:text="Button 3"></Button> <Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt4" android:text="Button 4"></Button> </LinearLayout> and I want this "List" of buttons to inherit the current style for ListView items. This is my current status of the stylesheet. The CKButton style gets applied over the Activity Theme. <style name="CKButton" parent="android:style/Widget.Button"> <item name="android:textSize">21sp</item> <item name="android:layout_margin">0dip</item> <!--<item name="android:background">@drawable/button_background</item>--> <item name="android:textColor">@color/button_text_normal</item> <item name="android:padding">10dip</item> <item name="android:gravity">left|center_horizontal</item> </style> As you see I tried to draw the button background myself, but depending on the system default theme the background-color changes and therefore defining a static color is not an option. Is there a way to inherit the default ListView Row background within that buttons?

    Read the article

  • Fixed footer not displaying the bottom-most list item

    - by Mohit Deshpande
    Here is my XML layout: <?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"> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> </ListView> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentBottom="true"> <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="1" /> <Button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="2" /> </LinearLayout> </RelativeLayout> Which causes this problem: The listview item (outlined in red) is behind the fixed footer and cannot be used. Any solutions?

    Read the article

  • checkbox unchecked when i scroll listview in android

    - by Mathew
    I am new to android development. I created a listview with textbox and checkbox. When I check the checkbox and scroll it down to check some other items in the list view, the older ones are unchecked. How to avoid this problem in listview? Please guide me with my code. Here is the code: 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"> <TextView android:id="@+id/TextView01" android:layout_height="wrap_content" android:text="List of items" android:textStyle="normal|bold" android:gravity="center_vertical|center_horizontal" android:layout_width="fill_parent"></TextView> <ListView android:id="@+id/ListView01" android:layout_height="250px" android:layout_width="fill_parent"> </ListView> <Button android:text="Save" android:id="@+id/btnSave" android:layout_width="wrap_content" android:layout_height="wrap_content"> </Button> </LinearLayout> This is the xml page I used to create dynamic list row: listview.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:gravity="left|center" android:layout_width="wrap_content" android:paddingBottom="5px" android:paddingTop="5px" android:paddingLeft="5px"> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#FFFF00" android:text="hi"></TextView> <TextView android:text="hello" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10px" android:textColor="#0099CC"></TextView> <EditText android:id="@+id/txtbox" android:layout_width="120px" android:layout_height="wrap_content" android:textSize="12sp" android:layout_x="211px" android:layout_y="13px"> </EditText> <CheckBox android:id="@+id/chkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> This is my activity class. CustomListViewActivity.java: package com.listivew; import android.app.Activity; import android.os.Bundle; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class CustomListViewActivity extends Activity { ListView lstView; static Context mContext; Button btnSave; private static class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public EfficientAdapter(Context context) { mInflater = LayoutInflater.from(context); } public int getCount() { return country.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.listview, parent, false); holder = new ViewHolder(); holder.text = (TextView) convertView .findViewById(R.id.TextView01); holder.text2 = (TextView) convertView .findViewById(R.id.TextView02); holder.txt = (EditText) convertView.findViewById(R.id.txtbox); holder.cbox = (CheckBox) convertView.findViewById(R.id.chkbox1); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.text.setText(curr[position]); holder.text2.setText(country[position]); holder.txt.setText(""); holder.cbox.setChecked(false); return convertView; } public class ViewHolder { TextView text; TextView text2; EditText txt; CheckBox cbox; } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); lstView = (ListView) findViewById(R.id.ListView01); lstView.setAdapter(new EfficientAdapter(this)); btnSave = (Button)findViewById(R.id.btnSave); mContext = this; btnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // I want to print the text which is in the listview one by one. //Later i will insert it in the database // Toast.makeText(getBaseContext(), "EditText Value, checkbox value and other values", Toast.LENGTH_SHORT).show(); for (int i = 0; i < lstView.getCount(); i++) { View listOrderView; listOrderView = lstView.getChildAt(i); try{ EditText txtAmt = (EditText)listOrderView.findViewById(R.id.txtbox); CheckBox cbValue = (CheckBox)listOrderView.findViewById(R.id.chkbox1); if(cbValue.isChecked()== true){ String amt = txtAmt.getText().toString(); Toast.makeText(getBaseContext(), "Amount is :"+amt, Toast.LENGTH_SHORT).show(); } }catch (Exception e) { // TODO: handle exception } } } }); } private static final String[] country = { "item1", "item2", "item3", "item4", "item5", "item6","item7", "item8", "item9", "item10", "item11", "item12" }; private static final String[] curr = { "1", "2", "3", "4", "5", "6","7", "8", "9", "10", "11", "12" }; } Please help me to slove this problem. I have referred in many places. But I could not get proper answer to solve this problem. Please provide me the code to avoid unchecking the checkbox while scrolling up and down. Thank you.

    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

  • Android Developing App crashes on startup

    - by alexnavratil
    I currently develop an application which contains a custom ListView. I developed a custom array adapter. I think my app crashes here: ListView DirectoryView = (ListView) findViewById(R.id.fileListView); So i think the error is in the activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ListView android:id="@+id/fileListView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > </ListView> Here is my LogCat: 09-09 11:19:21.254: E/Trace(1152): error opening trace file: No such file or directory (2) 09-09 11:19:21.484: D/AndroidRuntime(1152): Shutting down VM 09-09 11:19:21.484: W/dalvikvm(1152): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 09-09 11:19:21.504: E/AndroidRuntime(1152): FATAL EXCEPTION: main 09-09 11:19:21.504: E/AndroidRuntime(1152): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.teamdroid.explorer/com.teamdroid.explorer.MainActivity}: java.lang.NullPointerException 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread.access$600(ActivityThread.java:130) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.os.Handler.dispatchMessage(Handler.java:99) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.os.Looper.loop(Looper.java:137) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread.main(ActivityThread.java:4745) 09-09 11:19:21.504: E/AndroidRuntime(1152): at java.lang.reflect.Method.invokeNative(Native Method) 09-09 11:19:21.504: E/AndroidRuntime(1152): at java.lang.reflect.Method.invoke(Method.java:511) 09-09 11:19:21.504: E/AndroidRuntime(1152): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 09-09 11:19:21.504: E/AndroidRuntime(1152): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 09-09 11:19:21.504: E/AndroidRuntime(1152): at dalvik.system.NativeStart.main(Native Method) 09-09 11:19:21.504: E/AndroidRuntime(1152): Caused by: java.lang.NullPointerException 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.Activity.findViewById(Activity.java:1825) 09-09 11:19:21.504: E/AndroidRuntime(1152): at com.teamdroid.explorer.listDirectory.getDirectory(listDirectory.java:20) 09-09 11:19:21.504: E/AndroidRuntime(1152): at com.teamdroid.explorer.MainActivity.onCreate(MainActivity.java:33) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.Activity.performCreate(Activity.java:5008) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 09-09 11:19:21.504: E/AndroidRuntime(1152): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 09-09 11:19:21.504: E/AndroidRuntime(1152): ... 11 more Please can you help me. I am searching this error for 2 day. thanks!

    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

  • Preference List only shows first element

    - by jmunoz
    I am developing a PreferenceActivity with custom Preference views. My problem is that I created a view with a ListView and it only shows the first element. I post my code and an image: http://imageshack.us/photo/my-images/545/sc20120307161530.png/ xml: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:key="player_settings" android:title="@string/settings_player_config" > <EditTextPreference android:defaultValue="@string/settings_player_default_name" android:dialogMessage="@string/settings_player_summary" android:dialogTitle="@string/settings_playersname" android:key="player_name" android:summary="@string/settings_player_summary" android:title="@string/settings_playersname" /> </PreferenceCategory> <PreferenceCategory android:key="volume" android:title="@string/settings_volume" > <com.battleship.preferences.SeekBarPreferences android:defaultValue="50" android:key="volume" android:title="@string/settings_volume" /> </PreferenceCategory> <PreferenceCategory android:key="shine" android:title="@string/settings_shine" > <com.battleship.preferences.SeekBarPreferences android:defaultValue="50" android:key="shine" android:title="@string/settings_shine" /> </PreferenceCategory> <PreferenceCategory android:key="themeTitle" android:title="@string/settings_group_themes" > <com.battleship.preferences.ListPreferences android:key="theme" /> </PreferenceCategory> <PreferenceCategory android:key="fontsTitle" android:title="@string/settings_group_font_size" > <com.battleship.preferences.ListPreferences android:key="font" /> </PreferenceCategory> </PreferenceScreen> The Custom ListPreference: package com.battleship.preferences; import com.battleship.R; import android.content.Context; import android.content.SharedPreferences; import android.media.AudioManager; import android.preference.Preference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.Toast; public class ListPreferences extends Preference implements OnCheckedChangeListener { public ListPreferences(Context context) { super(context); } public ListPreferences(Context context, AttributeSet attrs) { super(context, attrs); } public ListPreferences(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onClick() { super.onClick(); Toast t = Toast.makeText(getContext(), "HOLA!", 3); t.show(); } @Override protected View onCreateView(ViewGroup parent) { String[] contentString = new String[3]; if (getKey().equals("theme")) { contentString = new String[] { (getContext().getString(R.string.settings_theme_default)), (getContext().getString(R.string.settings_theme_black)), (getContext().getString(R.string.settings_theme_white)) }; } else { contentString = new String[] { (getContext().getString(R.string.settings_font_big)), (getContext().getString(R.string.settings_font_medium)), (getContext().getString(R.string.settings_font_little)) }; } ListView listView = new ListView(getContext()); ArrayAdapter<String> array = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_single_choice, android.R.id.text1, contentString); listView.setAdapter(array); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); return listView; } private void updatePreference(int intRadio) { SharedPreferences.Editor editor = getEditor(); editor.putInt(getKey(), intRadio); editor.commit(); } }

    Read the article

  • how to add a checkbox in a listview?

    - by Bugzy bug
    hello guys, i have a question, been stuck for a while, i dont know how can i add a checkbox in the list, for example if I have a list of items i want to be able to check them. my xml code is the following: <LinearLayout android:id="@+id/topLayout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_centerHorizontal="true" android:layout_height="wrap_content"> </LinearLayout> <LinearLayout android:id="@+id/middleLayout" android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent"> <LinearLayout android:id="@+id/leftMiddleLayout" android:orientation="vertical" android:layout_below="@+id/topLayout" android:layout_above="@+id/bottomLayout" android:layout_width="60px" android:layout_height="wrap_content" > <ListView android:id="@+id/checkboxList" android:layout_width="fill_parent" android:layout_height="wrap_content" ></ListView> <CheckBox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="false" android:text="test"> </CheckBox> </LinearLayout> <LinearLayout android:id="@+id/rightMiddleLayout" android:orientation="vertical" android:layout_below="@+id/topLayout" android:layout_above="@+id/bottomLayout" android:layout_width="280px" android:layout_height="wrap_content" > <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" ></ListView> <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/bottomLayout" android:layout_alignParentBottom="true" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="5pt" > <EditText android:id="@+id/insertNewItem" android:layout_width="220px" android:layout_height="wrap_content" /> <TextView android:layout_width="10px" android:layout_height="wrap_content" /> <Button android:id="@+id/addItemButton" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Add Item"/> </LinearLayout> if you have any ideas please let me know, its for my academic studies :(( Thank you!

    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

  • 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

  • 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

  • how to compare the two xml files and update the one xml file in java?

    - by prasad.gai
    I have created two xml files from those xml file i would like to compare one xml file with another xml file and update the xml file. I have created an xml file as follows: main.xml <?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="#00BFFF"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:visibility="visible"> </LinearLayout> <LinearLayout android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:visibility="visible"> </LinearLayout> </LinearLayout> </ScrollView> properties.xml <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <int name="linearLayout1" value="8" /> <int name="linearLayout2" value="0" /> </map> from the above two xml files i would like to compare with LinearLayout android:id ="@id/LinearLayout1" from main.xml with int name ="linearLayout1" from properties.xml. from the above properties.xml file where name ="linearLayout1" and value ="8" then i would like to update the main.xml file where as LinearLayout android:id="@id/linearLayout1" propertie value as android:visibility="gone" From the above xml file how can i update main.xml file by comparing properties.xml? please any body help me.....

    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

  • Android application displays black screen after running

    - by frgnvola
    When I click "Run as an Android Application" on Eclipse, the following is displayed in the console [2014-06-05 20:07:18 - StudentConnect] Android Launch! [2014-06-05 20:07:18 - StudentConnect] adb is running normally. [2014-06-05 20:07:18 - StudentConnect] Performing sandhu.student.connect.SplashActivity activity launch [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Refreshing resource folders. [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Starting incremental Pre Compiler: Checking resource changes. [2014-06-05 20:07:18 - StudentConnect] Nothing to pre compile! [2014-06-05 20:07:18 - StudentConnect] Starting incremental Package build: Checking resource changes. [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Skipping over Post Compiler. [2014-06-05 20:07:20 - StudentConnect] Application already deployed. No need to reinstall. [2014-06-05 20:07:20 - StudentConnect] Starting activity sandhu.student.connect.SplashActivity on device 0f0898b2 [2014-06-05 20:07:21 - StudentConnect] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sandhu.student.connect/.SplashActivity } [2014-06-05 20:07:21 - StudentConnect] ActivityManager: Warning: Activity not started, its current task has been brought to the front After deployed to my phone, it only displays a black screen. I recently implemented a splash screen, but it was working fine before; however I think it might have something to do with the problem. Here are my java and xml files: MainActivity.java package sandhu.student.connect; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { public WebView student_zangle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView student_zangle = (WebView) findViewById(R.id.student_zangle); student_zangle.loadUrl("https://zangleweb01.clovisusd.k12.ca.us/studentconnect/"); student_zangle.setWebViewClient(new WebViewClient()); student_zangle.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); WebSettings settings = student_zangle.getSettings(); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(true); settings.setLoadWithOverviewMode(true); settings.setUseWideViewPort(true); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { WebView student_zangle = (WebView) findViewById(R.id.student_zangle); if ((keyCode == KeyEvent.KEYCODE_BACK) && student_zangle.canGoBack()) { student_zangle.goBack(); return true; } else { finish(); } return super.onKeyDown(keyCode, event); } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <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:background="@drawable/blue" tools:context=".MainActivity" > <WebView android:id="@+id/student_zangle" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> SplashActivity.java package sandhu.student.connect; import android.os.Bundle; import android.preference.PreferenceActivity; public class SplashActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } } splash_activity.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/blue" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="250dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="145dp" android:contentDescription="@string/zangle_logo" android:src="@drawable/logo" /> </RelativeLayout> Also, here is a full copy of the logcat error output: 06-05 20:19:46.698: E/Watchdog(817): !@Sync 1952 06-05 20:20:09.971: E/memtrack(16438): Couldn't load memtrack module (No such file or directory) 06-05 20:20:09.971: E/android.os.Debug(16438): failed to load memtrack module: -2 06-05 20:20:11.012: E/memtrack(16451): Couldn't load memtrack module (No such file or directory) 06-05 20:20:11.012: E/android.os.Debug(16451): failed to load memtrack module: -2 06-05 20:20:11.202: E/EnterpriseContainerManager(817): ContainerPolicy Service is not yet ready!!! Please help me figure out what is wrong, or at least point me in the right direction. Thanks in advance.

    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

  • Android custom ListView unable to click on items

    - by MattC
    So I have a custom ListView object. The list items have two textviews stacked on top of each other, plus a horizontal progress bar that I want to remain hidden until I actually do something. To the far right is a checkbox that I only want to display when the user needs to download updates to their database(s). When I disable the checkbox by setting the visibility to Visibility.GONE, I am able to click on the list items. When the checkbox is visible, I am unable to click on anything in the list except the checkboxes. I've done some searching but haven't found anything relevant to my current situation. I found this question but I'm using an overridden ArrayAdapter since I'm using ArrayLists to contain the list of databases internally. Do I just need to get the LinearLayout view and add an onClickListener like Tom did? I'm not sure. Here's the listview row layout 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="?android:attr/listPreferredItemHeight" android:padding="6dip"> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <TextView android:id="@+id/UpdateNameText" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:textSize="18sp" android:gravity="center_vertical" /> <TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:id="@+id/UpdateStatusText" android:singleLine="true" android:ellipsize="marquee" /> <ProgressBar android:id="@+id/UpdateProgress" android:layout_width="fill_parent" android:layout_height="wrap_content" android:indeterminateOnly="false" android:progressDrawable="@android:drawable/progress_horizontal" android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal" android:minHeight="10dip" android:maxHeight="10dip" /> </LinearLayout> <CheckBox android:text="" android:id="@+id/UpdateCheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> And here's the class that extends the ListActivity. Obviously it's still in development so forgive the things that are missing or might be left laying around: import java.util.List; import android.app.ListActivity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import com.xxxx.android.R; import com.xxxx.android.DAO.AccountManager; import com.xxxx.android.model.UpdateItem; public class UpdateActivity extends ListActivity { AccountManager lookupDb; boolean allSelected; UpdateListAdapter list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); lookupDb = new AccountManager(this); lookupDb.loadUpdates(); setContentView(R.layout.update); allSelected = false; list = new UpdateListAdapter(this, R.layout.update_row, lookupDb.getUpdateItems()); setListAdapter(list);

    Read the article

  • UI android question/problem with Listview

    - by user309554
    Hi, I'm trying to recreate the UI screen called 'My Places' that is used in the Weather Channel app. I'd attach a screenshot of the screen, but I can't seem to do it here. It seems they're using two listviews one on top of the other, but I'm not sure for certain. Could anybody confirm this for me? If they are doing this, how is this done? I've tried to implement this, but without full success. My top listview 'Add a place' 'comes up correctly, but the bottom listview will not appear/populate for me? I shall attach my code so far...... Any help would be greatly appreciated. Thanks Simon header_row.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:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6dip" android:src="@drawable/ic_menu_add" / LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent" TextView android:id="@+id/caption" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center_vertical" android:text="Add a place"/ /LinearLayout /LinearLayout main.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="?android:attr/listPreferredItemHeight" android:padding="6dip" ListView android:id="@+id/header" android:layout_width="wrap_content" android:layout_height="wrap_content"/ LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"/ /LinearLayout /LinearLayout public class ListViewTest extends Activity { private static String[] items={"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", "vel", "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", "vel", "erat", "placerat", "ante", "porttitor", "sodales", "pellentesque", "augue", "purus"}; private ListView Header; private ListView List; private ArrayList caption = null; private CaptionAdapter adapter; private ArrayAdapter listAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); caption = new ArrayList(); Caption cap = new Caption(); cap.setCaption("Add a place"); caption.add(cap); this.adapter = new CaptionAdapter(this, R.layout.header_row, caption); Header = (ListView) findViewById(R.id.header); Header.setAdapter(adapter); //Log.d("ListViewTest", "caption size is:" + caption.size()); adapter.notifyDataSetChanged(); List = (ListView) findViewById(R.id.list); listAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, items); List.setAdapter(listAdapter); listAdapter.notifyDataSetChanged(); //setListAdapter(new ArrayAdapter(this, //android.R.layout.simple_list_item_1, //items)); } private class CaptionAdapter extends ArrayAdapter { private ArrayList caption; public CaptionAdapter(Context context, int textViewResourceId, ArrayList caption) { super(context, textViewResourceId, caption); this.caption = caption; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.header_row, null); } Caption c = caption.get(position); if (c != null) { TextView caption = (TextView) v.findViewById(R.id.caption); if (caption != null) { caption.setText(c.getCaption()); } } return v; } } }

    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

  • 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

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