Search Results

Search found 15838 results on 634 pages for 'android layout'.

Page 10/634 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Can't get precise layout on Nexus One

    - by Johnny
    I want to use precise layout on Nexus One, my code is like this: <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="90px"> <ImageView android:layout_width="5px" android:layout_height="fill_parent" android:src="@drawable/d10" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d5" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d6" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d7" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d8" /> <ImageView android:layout_width="94px" android:layout_height="fill_parent" android:src="@drawable/d9" /> <ImageView android:layout_width="5px" android:layout_height="fill_parent" android:src="@drawable/d10" /> But it turns out on Nexus One, the screen width is not 480 px. So this LinearLayout will exceed the screen width. How should I fix this?

    Read the article

  • How to set padding to columns in table layout dynamically

    - by Praveenb
    Hi all, I am trying to create a table layout with buttons dynamically. I am able to get the table layout with buttons. bt i need padding between buttons. How i can get programatically. I tried following code bt private void showCowsTblField() { for (int row = 0; row < numberOfRowsInField-1; row++) { TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT )); for (int column = 0; column < numberOfColumnsInField -1; column++) { blocks[row][column].setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); blocks[row][column].setPadding(blockPadding, blockPadding, blockPadding, blockPadding); tableRow.addView(blocks[row][column]); tableRow.setPadding(blockPadding, blockPadding, blockPadding, blockPadding); } tblCows.addView(tableRow,new TableLayout.LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); } } Please let me know.... Thanks.

    Read the article

  • Android, FragmentActivity and prevent Swipe

    - by FIG-GHD742
    I use android.support.v4.app.FragmentActivity for create a app with multi fragment/panels that can be access by drag/swipe between different part of the app. In one of my fragment I has a zoomable view and my problem is in case I is on the zoomable view I will prevent the use for drag/swipe to a other fragment. I has try to hack into android.support.v4.view.ViewPager for get the action from on Touch event but not work. I has try all of this case but not work: (All code is a a part of subclass to android.support.v4.view.ViewPager) Case 1: // Not working @Override protected void onPageScrolled(int position, float offset, int offsetPixels) { if (isPreventDrag()) { super.onPageScrolled(position, 1, 0); } else { super.onPageScrolled(position, offset, offsetPixels); } } Case 2: // Work but stop all event include the event to the target image view. @Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastX = ev.getX(); // float lockScroll = false; return super.onInterceptTouchEvent(ev); case MotionEvent.ACTION_MOVE: this.lockScroll = this.isPreventDrag(); break; } if (lockScroll) { ev.setLocation(lastX, ev.getY()); return super.onInterceptTouchEvent(ev); } else { return super.onInterceptTouchEvent(ev); } } Case 3: // Work good, but by some unknown error I can drag the screen // some pixels before this stop the event. @Override public boolean onTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return true; } else { return super.onTouchEvent(ev); } } I want a easy way to deactivate stop or deactivate if the use is allow to switch to a other Fragment. Here is a working code for me, I don't know what error I do before. // This work for me, @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return false; } else { return super.onInterceptTouchEvent(ev); } }

    Read the article

  • java.lang.RuntimeException: Unable to start activity ComponentInfo cannot be cast to android.widget.ZoomControls

    - by Hwl
    I'm new to android development, hope you all can help me. I got this androidVNC viewer source code from internet. When i'm running the androidVNC application in the emulator, it will exit automatically then i get following errors in LogCat. Can anyone one help me? Thanks. FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{android.androidVNC/android.androidVNC.VncCanvasActivity}: java.lang.ClassCastException: com.antlersoft.android.zoomer.ZoomControls cannot be cast to android.widget.ZoomControls at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4340) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: com.antlersoft.android.zoomer.ZoomControls cannot be cast to android.widget.ZoomControls at android.androidVNC.VncCanvasActivity.onCreate(VncCanvasActivity.java:585) at android.app.Activity.performCreate(Activity.java:4465) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919) ... 11 more This is the ZoomControls java file: package com.antlersoft.android.zoomer; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.animation.AlphaAnimation; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ZoomButton; public class ZoomControls extends LinearLayout { private final ZoomButton mZoomIn; private final ZoomButton mZoomOut; private final ImageButton mZoomKeyboard; public ZoomControls(Context context) { this(context, null); } public ZoomControls(Context context, AttributeSet attrs) { super(context, attrs); setFocusable(false); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.zoom_controls, this, // we are the parent true); mZoomIn = (ZoomButton) findViewById(R.id.zoomIn); mZoomOut = (ZoomButton) findViewById(R.id.zoomOut); mZoomKeyboard = (ImageButton) findViewById(R.id.zoomKeys); } public void setOnZoomInClickListener(OnClickListener listener) { mZoomIn.setOnClickListener(listener); } public void setOnZoomOutClickListener(OnClickListener listener) { mZoomOut.setOnClickListener(listener); } public void setOnZoomKeyboardClickListener(OnClickListener listener) { mZoomKeyboard.setOnClickListener(listener); } /* * Sets how fast you get zoom events when the user holds down the * zoom in/out buttons. */ public void setZoomSpeed(long speed) { mZoomIn.setZoomSpeed(speed); mZoomOut.setZoomSpeed(speed); } @Override public boolean onTouchEvent(MotionEvent event) { /* Consume all touch events so they don't get dispatched to the view * beneath this view. */ return true; } public void show() { fade(View.VISIBLE, 0.0f, 1.0f); } public void hide() { fade(View.GONE, 1.0f, 0.0f); } private void fade(int visibility, float startAlpha, float endAlpha) { AlphaAnimation anim = new AlphaAnimation(startAlpha, endAlpha); anim.setDuration(500); startAnimation(anim); setVisibility(visibility); } public void setIsZoomInEnabled(boolean isEnabled) { mZoomIn.setEnabled(isEnabled); } public void setIsZoomOutEnabled(boolean isEnabled) { mZoomOut.setEnabled(isEnabled); } @Override public boolean hasFocus() { return mZoomIn.hasFocus() || mZoomOut.hasFocus(); } } This is the zoom_controls XML file: <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ZoomButton android:id="@+id/zoomOut" android:background="@drawable/btn_zoom_down" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageButton android:id="@+id/zoomKeys" android:background="@android:drawable/ic_dialog_dialer" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ZoomButton android:id="@+id/zoomIn" android:background="@drawable/btn_zoom_up" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </merge>

    Read the article

  • Android visibility issue with checkbox

    - by fxi
    Hi all! I´m using a checkbox in my code that when its checked it makes a textview and a editText visibles, but if I uncheck de checkbox they continue being visible instead of dissapear. Here is the code: final CheckBox save = (CheckBox) findViewById(R.id.checkbox); save.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks, depending on whether it's now checked if (((CheckBox) v).isChecked()) { nameText.setVisibility(1); editName.setVisibility(1); } else { nameText.setVisibility(0); editName.setVisibility(0); } } }); And part of the xml which is inside an Relative Layout: <LinearLayout android:id="@+id/linearLayout3" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below = "@+id/linearLayout2"> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/name" android:visibility="invisible"/> <EditText android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:visibility="invisible"/> <CheckBox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/save" /> </LinearLayout> What should i do to make the textView and EditText dissapear when i uncheck the checkbox? Thank you!

    Read the article

  • Java method for android:layout_gravity

    - by André Leitão
    Hi folks, I would like to know if is there a way to call android:layout_gravity property from a java method. I didn't found any method in Android documentation to do it. This is the picture of the layout I want to implement: I know to do it through xml, as following: <FrameLayout xlmns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:layout_gravity="left|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="<" /> <Button android:layout_gravity="right|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=">" /> </FrameLayout> But in my situation, I need to do it through Java code, because I'll implement another layout views dinamically. To avoid merging xml layout with Java code, I would prefer make all layout using Java. Can you help me? Thanks. André Leitão

    Read the article

  • Unable to stretch TableLayout to screen width

    - by Rendrik
    I've tried unsuccessfully for quite a few hours now to simply get a TableLayout to scale to the full screen. I've tried stretchColumns, shrinkColumns, (specifying the column index or using *) you name it. It's almost as if the parent element (TableLayout) is completely ignoring 'android:layout_width="fill_parent"'. I've read through similar questions here, though they haven't solved it for me. The XML below has 3 rows, and the table always shrink wraps to the size of the content. Apparently I'm too new to post pictures(?) Here is the XML rendered into the project i'm working on. http://www.dashiva.com/images/Capture.png What am I missing here, it's quite frustrating! <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*"> <TableRow> <TextView android:id="@+id/AmountText" android:text="@string/general_amount" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardText" android:text="@string/general_card" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="@string/general_date" android:id="@+id/DateText" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/ErrorText" android:text="@string/general_error" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <TextView android:text="Amount here..." android:id="@+id/AmountNum" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardNum" android:text="Num here..." android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="date here..." android:id="@+id/DateDate" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="Code here..." android:id="@+id/ErrorCode" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <ImageView android:id="@+id/cc_image" android:src="@drawable/mastercard" android:background="@drawable/row_bg2" android:layout_gravity="center" android:layout_weight="1"></ImageView> <TextView android:id="@+id/ResponseText" android:layout_span="4" android:text="Response text here..." android:textSize="18dip" android:layout_weight="1"></TextView> </TableRow> <ImageView android:layout_gravity="center_vertical" android:background="@drawable/gradient_bg" android:layout_height="3dip" android:layout_width="fill_parent"></ImageView> </TableLayout>

    Read the article

  • android searchable not opening

    - by ng93
    Hi im trying to use a searchable activity in my application but when the search button is pressed nothing happens AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.test" android:versionCode="1" android:versionName="1.0.0" android:configChanges="keyboardHidden|orientation"> <uses-sdk android:minSdkVersion="7"/> <application android:icon="@drawable/icon" android:label="Test"> <activity android:name=".Test" android:label="Test" android:debuggable="true" android:theme="@android:style/Theme.NoTitleBar" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".Searchable"> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/> </activity> <meta-data android:name="android.app.default_searchable" android:value=".Searchable"/> </application> </manifest> Searchable.xml (res/xml/searchable.xml) <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Search" android:hint="Perform Search"> </searchable> Searchable.java (src/com/test/test/Searchable.java) package com.test.test; import android.app.Activity; import android.app.SearchManager; import android.content.Intent; import android.os.Bundle; public class Searchable extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); handleIntent(getIntent()); } @Override protected void onNewIntent(Intent intent) { setIntent(intent); handleIntent(intent); } private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); } } } TIA, ng93

    Read the article

  • How to place a Linearlayout at bottom inside a Relativelayout in android

    - by SANDHYA
    I need to place a linear layout at bottom inside a relativelayout which is the top most parent in xml. How can i do this? Please help me. <?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" android:background="@drawable/background" android:orientation="vertical" > <RelativeLayout ....... <<--- this should occupy total available space </Relativelayout <Linearlayout ....... <<-- this should place at bottom always with height 50dp </LineaLayout> </ReltiveLayout>

    Read the article

  • I can't understand this issue java.lang.IndexOutOfBoundsException.

    - by praveenb
    I've strange issue, that My application is working fine on some devices, But its crashing one of the client device(on Galaxy Nexus 4.1.1 v) at app starting screen. I get this stack trace from ACRA report. java.lang.IndexOutOfBoundsException at android.graphics.Paint.getTextRunAdvances(Paint.java:1731) at android.graphics.Paint.getTextRunAdvances(Paint.java:1704) at android.text.MeasuredText.addStyleRun(MeasuredText.java:164) at android.text.MeasuredText.addStyleRun(MeasuredText.java:204) at android.text.StaticLayout.generate(StaticLayout.java:281) at android.text.DynamicLayout.reflow(DynamicLayout.java:284) at android.text.DynamicLayout.(DynamicLayout.java:170) at android.widget.TextView.makeSingleLayout(TextView.java:5843) at android.widget.TextView.makeNewLayout(TextView.java:5741) at android.widget.TextView.onMeasure(TextView.java:6098) at android.view.View.measure(View.java:15172) at android.widget.LinearLayout.measureVertical(LinearLayout.java:833) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148) at android.view.View.measure(View.java:15172) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Im seeing above stack trace. I'm unable to understand the issue. Please help me on tacking the issue. Thank you.

    Read the article

  • using Unity Android In a sub view and add style and actionbar

    - by aeroxr1
    I exported a simple animation from Unity3D (version 4.5) in android project. With eclipse I modified the manifest and added another activity. In this activity I put a button that it makes start the animation,and this is the result. The action bar appear in the main activity but it doesn't in the unity's activity :( This is the unity's activity's code : package com.rabidgremlin.tut.redcube; import android.app.NativeActivity; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.os.Bundle; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import com.unity3d.player.UnityPlayer; public class UnityPlayerNativeActivity extends NativeActivity { protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code // Setup activity layout @Override protected void onCreate (Bundle savedInstanceState) { //requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().takeSurface(null); //setTheme(android.R.style.Theme_NoTitleBar_Fullscreen); getWindow().setFormat(PixelFormat.RGB_565); mUnityPlayer = new UnityPlayer(this); /*if (mUnityPlayer.getSettings ().getBoolean ("hide_status_bar", true)) getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); */ setContentView(mUnityPlayer); mUnityPlayer.requestFocus(); } // Quit Unity @Override protected void onDestroy () { mUnityPlayer.quit(); super.onDestroy(); } // Pause Unity @Override protected void onPause() { super.onPause(); mUnityPlayer.pause(); } // eliminiamo questa onResume() e proviamo a modificare la onResume() // Resume Unity @Override protected void onResume() { super.onResume(); mUnityPlayer.resume(); } // inseriamo qualche modifica qui // This ensures the layout will be correct. @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mUnityPlayer.configurationChanged(newConfig); } // Notify Unity of the focus change. @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); mUnityPlayer.windowFocusChanged(hasFocus); } // For some reason the multiple keyevent type is not supported by the ndk. // Force event injection by overriding dispatchKeyEvent(). @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_MULTIPLE) return mUnityPlayer.injectEvent(event); return super.dispatchKeyEvent(event); } // Pass any events not handled by (unfocused) views straight to UnityPlayer @Override public boolean onKeyUp(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); } @Override public boolean onTouchEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); } /*API12*/ public boolean onGenericMotionEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); } } How can I add the action bar and the style of the first activity to unity's animation activity ?

    Read the article

  • View layout after setvisibility

    - by user1478296
    I've got problem with setting visibility to relative layout. I have part of big layout in relativelayout and below that next TextView. But in my code, when myRelativeLayout.setVisibility(View.GONE); is called, TextView which is below that did not appear. I tried several ways to rearange layout, but i need that textview under it. Thanks My XML: <merge xmlns:android="http://schemas.android.com/apk/res/android" > <ScrollView android:id="@+id/scrollView_liab_ra_flipper_04" android:layout_width="fill_parent" android:layout_height="wrap_content" > <RelativeLayout android:id="@+id/linearLayout_liab_ra_flipper_04" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/someTextView" android:text="Something" /> <!-- This relative layout should be removable --> <RelativeLayout android:id="@+id/vg_liab_ra_04_flipper_car_container_visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/someTextView" > <TextView android:id="@+id/tv_1" style="@style/WhiteFormText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginTop="2dp" android:text="@string/licence_plate_counter" > </TextView> <EditText android:id="@+id/et_1" style="@style/WhiteFormField" android:layout_below="@+id/tv_1" android:hint="@string/licence_plate_hint" > </EditText> </RelativeLayout> <!-- This textview is not visible if relative layout is gone --> <TextView android:id="@+id/tv_liab_ra_04_flipper_mandat" style="@style/WhiteFormTextHint" android:layout_below="@+id/vg_liab_ra_04_flipper_car_container_visible" android:layout_marginBottom="15dp" android:text="@string/mandatory_field" > </TextView> </RelativeLayout> </ScrollView> </merge> Java Code: private void hideCar() { if (!accident.getParticipant(0)) { rlCarContainer.setVisibility(View.GONE); } else { rlCarContainer.setVisibility(View.VISIBLE); } }

    Read the article

  • My google map android app keeps crashing

    - by Manny264
    I have followed about two tutorials from vogella and some other tutorial that looked similar...very similar but to no avail. I load the app on my nexus 7 and it just crashes "Unfortunately MyMapView has stopped working" on launch.This is the manifest: ` <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <uses-library android:name="com.google.android.maps" /> <activity android:name="com.macmozart.mymapview.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBZ1Bt7rjB863Jy-B05zls6k8XZsBGQ6-4" /> </application> ` Followed by my main layout: <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /> and finally my java class: package com.macmozart.mymapview; import android.app.Activity; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.maps.*; public class MainActivity extends Activity { static final LatLng HAMBURG = new LatLng(53.558, 9.927); static final LatLng KIEL = new LatLng(53.551, 9.993); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); if (map != null) { Marker hamburg = map.addMarker(new MarkerOptions() .position(HAMBURG).title("Hamburg")); Marker kiel = map.addMarker(new MarkerOptions() .position(KIEL) .title("Kiel") .snippet("Kiel is cool") .icon(BitmapDescriptorFactory .fromResource(R.drawable.ic_launcher))); map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15)); // Zoom in, animating the camera. map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); } } } Any idea what im doing wrong I really need this to work

    Read the article

  • How can I get an Android TableLayout to fill the screen?

    - by Timmmm
    Hi, I'm battling with Android's retarded layout system. I'm trying to get a table to fill the screen (simple right?) but it's ridiculously hard. I got it to work somehow in XML like this: <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent"> <TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"> <Button android:text="A" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> <Button android:text="B" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> </TableRow> <TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"> <Button android:text="C" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> <Button android:text="D" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> </TableRow> However I can not get it to work in Java. I've tried a million combinations of the LayoutParams, but nothing ever works. This is the best result I have which only fills the width of the screen, not the height: table = new TableLayout(this); // Java. You suck. TableLayout.LayoutParams lp = new TableLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); table.setLayoutParams(lp); // This line has no effect! WHYYYY?! table.setStretchAllColumns(true); for (int r = 0; r < 2; ++r) { TableRow row = new TableRow(this); for (int c = 0; c < 2; ++c) { Button btn = new Button(this); btn.setText("A"); row.addView(btn); } table.addView(row); } Obviously the Android documentation is no help. Anyone have any ideas?

    Read the article

  • Do all widgets in an Android layout file require layout_width and layout_height ?

    - by Eno
    I have a ListView composed of LinearLayouts. Inside each is an ImageView, TextView and another ImageView laid out horizontally: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <ImageButton android:id="@+id/thumbnail" android:background="@color/white" android:paddingTop="10dip" android:paddingLeft="8dip" android:paddingBottom="10dip" /> <TextView android:id="@+id/title" android:background="@color/white" android:textColor="@color/bntext" android:paddingTop="10dip" android:paddingLeft="8dip" /> <ImageButton android:src="@drawable/green_arrow_small" android:background="@color/white" /> </LinearLayout>

    Read the article

  • Unable to Start Activity ComponentInfo when Starting a New Activity

    - by Timtim17
    {I know there's already a whole bunch of questions like this, but I can't see any problems that related to my program.} I have an Android App that is supposed to take a name from a EditText and put it in a TextView in another activity. It previously worked, but then I wanted it to start another activity if the EditText's value was equal to "ANDROID". However, now the app crashes whenever I try to start either activity. First Activity: package net.timtim17.dev.android.fun.nametag; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText) findViewById(R.id.editText1); Button submit = (Button) findViewById(R.id.button1); submit.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { String text = et.getText().toString(); if(text.equals("ANDROID")){ Intent android = new Intent(MainActivity.this, AndroidNameTag.class); startActivity(android); }else{ Intent intent = new Intent(MainActivity.this, NameTag.class); intent.putExtra("name", text); startActivity(intent); } } }); } } NameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class NameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tag); TextView tv = (TextView) findViewById(R.id.textView2); tv.setText(getIntent().getExtras().getString("name")); } } AndroidNameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.ImageView; public class AndroidNameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_android); ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setBackgroundResource(R.anim.animation); AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); } } LogCat Error: 10-26 11:26:35.602: E/AndroidRuntime(2900): FATAL EXCEPTION: main 10-26 11:26:35.602: E/AndroidRuntime(2900): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.timtim17.dev.android.fun.nametag/net.timtim17.dev.android.fun.nametag.NameTag}: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.access$600(ActivityThread.java:141) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Handler.dispatchMessage(Handler.java:99) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Looper.loop(Looper.java:137) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.main(ActivityThread.java:5103) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invokeNative(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invoke(Method.java:525) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-26 11:26:35.602: E/AndroidRuntime(2900): at dalvik.system.NativeStart.main(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): Caused by: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at net.timtim17.dev.android.fun.nametag.NameTag.onCreate(NameTag.java:15) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Activity.performCreate(Activity.java:5133) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 10-26 11:26:35.602: E/AndroidRuntime(2900): ... 11 more MainActivity 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=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="16dp" android:text="@string/main_text" android:textAppearance="?android:attr/textAppearanceMedium" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="14dp" android:text="@string/submit_button" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignTop="@+id/button1" android:ems="10" android:inputType="textPersonName" > <requestFocus /> </EditText>

    Read the article

  • Start TabActivity from ListActivity (which is content of parent TabActivity) in Android

    - by barmaleikin
    Hi guys, I have problems with switching between activities. I have two TabActivities (A and B), each of of tab activity has 4 tabs with ListActivity. I am trying to show B activity onListItemClick. Code on click is: Intent intent = new Intent(getApplicationContext(), TabBActivity.class); startActivity(intent); My manifest file is following: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true"> <activity android:name=".SplashScreen" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TabAActivity"> <intent-filter> <action android:name="com.TabAActivity" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TabAListActivityA" android:label="AA"/> <activity android:name=".TabAListActivityB" android:label="AB"/> <activity android:name=".TabAListActivityC" android:label="AC"/> <activity android:name=".TabBActivity" android:label="B"/> <activity android:name=".TabAListBctivityA" android:label="BA"/> <activity android:name=".TabAListBctivityB" android:label="BB"/> <activity android:name=".TabAListBctivityC" android:label="BC"/> </application> </manifest> Is my manifest correct or maybe something is wrong with code? I would appreciate any help on this topic.

    Read the article

  • java.lang.NoClassDefFoundError at Runtime Android Widget

    - by pxrb66
    I have a problem during runtime of my Android widget with Android 2.3.3 and older. When i install my widget on the screen, this error is printed : 11-03 10:26:31.127: E/AndroidRuntime(404): FATAL EXCEPTION: main 11-03 10:26:31.127: E/AndroidRuntime(404): java.lang.NoClassDefFoundError: com.app.myapp.StackWidgetService 11-03 10:26:31.127: E/AndroidRuntime(404): at com.app.myapp.StackWidgetProvider.onUpdate(StackWidgetProvider.java:229) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:61) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.app.mobideals.StackWidgetProvider.onReceive(StackWidgetProvider.java:216) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1794) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.access$2400(ActivityThread.java:117) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.os.Handler.dispatchMessage(Handler.java:99) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.os.Looper.loop(Looper.java:123) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.main(ActivityThread.java:3683) 11-03 10:26:31.127: E/AndroidRuntime(404): at java.lang.reflect.Method.invokeNative(Native Method) 11-03 10:26:31.127: E/AndroidRuntime(404): at java.lang.reflect.Method.invoke(Method.java:507) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 11-03 10:26:31.127: E/AndroidRuntime(404): at dalvik.system.NativeStart.main(Native Method) The problem is due to the fact that the compilator don't arrive to perform the link to the StackWidgetService class at this line in onUpdate method of StackWidgetProvider class : public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // update each of the widgets with the remote adapter for (int i = 0; i < appWidgetIds.length; ++i) { // Here we setup the intent which points to the StackViewService which will // provide the views for this collection. Intent intent = new Intent(context, StackWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); The widget works well with other version of Android like 3.0, 4.0 etc... Please help me :)

    Read the article

  • Android local search

    - by Aleksander O
    Hi! I'm trying to implement a local search in my activity. I've added an appropriate intent filter and metadata tag to manifest file but if I click Search button it invokes standard android search box. What's my problem? Manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nixsolutions.invertigation.android.dataprovider" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <provider android:name="NoteProvider" android:authorities="com.nixsolutions.investigation.android.NoteProvider"> </provider> <activity android:name="NotesList"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> </activity> </application> <uses-sdk android:minSdkVersion="7" /> </manifest> searchable.xml: <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Custom search" android:hint="Custom hint" android:searchMode="showSearchLabelAsBadge" />

    Read the article

  • USA keyboard layout keeps getting added on login

    - by Scott Severance
    I use the USA International keyboard layout. Every time I log in, the USA layout gets added to my list of layouts, which causes the keyboard layout indicator to be displayed. How can I stop the USA layout from being added? Additional info: I'm running Natty. Until recently, I had all four layout slots filled. Recently I changed from SCIM to iBus. With this change, I no longer need multiple layouts since iBus better handles my needs. So, I don't want both indicators (iBus and Keyboard layout) showing up.

    Read the article

  • How to get current gnome keyboad layout from terminal

    - by ftiaronsem
    For usage in a bash script, I need to get the gnome keyboard layout the user is currently using. For example if the user sets its keyboard layout to en-us , I need a bash command that prints me this. How can I get that information? Update: setxkbmap -query is unfortunatelly not working. Below is the ouput with the en (first command) and the de (second command) layout activated. Switching keyboard layout seems to be have some relation with gnome session configuration setxkbmap -query rules: evdev model: pc105 layout: us,de variant: , options: terminate:ctrl_alt_bksp,lv3:ralt_switch,grp:alts_toggle setxkbmap -query rules: evdev model: pc105 layout: us,de variant: , options: terminate:ctrl_alt_bksp,lv3:ralt_switch,grp:alts_toggle

    Read the article

  • Get the screen height in Android

    - by Dan Bray
    How can I get the available height of the screen in Android? I need to the height minus the status bar / menu bar or any other decorations that might be on screen and I need it to work for all devices. Also, I need to know this in the onCreate function. I know this question has been asked before but I have already tried their solutions and none of them work. Here are some of the things I have tried: I have tested this code on API 7 - 17. Unfortunately, on API 13 there is extra space at bottom both horizontally and vertically and on API 10, 8, and 7 there is not enough space at the bottom both horizontally and vertically. (I have not tested on obsolete API's): Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); screenWidth = metrics.widthPixels; screenHeight = metrics.heightPixels; TypedValue tv = new TypedValue(); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) screenHeight -= TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()); } int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) screenHeight -= getResources().getDimensionPixelSize(resourceId); This does not take into account the status bar / menu bar: Display display = getWindowManager().getDefaultDisplay(); screenWidth = display.getWidth(); screenHeight = display.getHeight(); Neither does this: Point size = new Point(); getWindowManager().getDefaultDisplay().getSize(size); screenWidth = size.x; screenHeight = size.y; Nor this: Point size = new Point(); getWindowManager().getDefaultDisplay().getRealSize(size); screenWidth = size.x; screenHeight = size.y; This does not work: Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); // since SDK_INT = 1; screenWidth = metrics.widthPixels; screenHeight = metrics.heightPixels; try { // used when 17 > SDK_INT >= 14; includes window decorations (statusbar bar/menu bar) screenWidth = (Integer) Display.class.getMethod("getRawWidth").invoke(display); screenHeight = (Integer) Display.class.getMethod("getRawHeight").invoke(display); } catch (Exception ignored) { // Do nothing } try { // used when SDK_INT >= 17; includes window decorations (statusbar bar/menu bar) Point realSize = new Point(); Display.class.getMethod("getRealSize", Point.class).invoke(display, realSize); screenWidth = realSize.x; screenHeight = realSize.y; } catch (Exception ignored) { // Do nothing } I then used the following code to subtract the height of the status bar and menu bar from the screen height: int result = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) result = getResources().getDimensionPixelSize(resourceId); screenHeight -= result; result = 0; if (screenHeight >= screenWidth) resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); else resourceId = getResources().getIdentifier("navigation_bar_height_landscape", "dimen", "android"); if (resourceId > 0) result = getResources().getDimensionPixelSize(resourceId); screenHeight -= result; On API 17 it correctly calculates the height of the status bar and menu bar in portrait but not in landscape. On API 10, it returns 0. I need it to work ideally on all devices or minimum API 7. Any help would be greatly appreciated.

    Read the article

  • Error when importing com.google, com.android.internal.Telephony, etc.

    - by psyhclo
    Hey, I've downloaded the android source code for CallLog, Contacts, Dialing in this link http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;a=tree But now, when I try to import this package on Eclipse, imports like: com.google, com.android.internal.Telephony, com.android.internal.R, com.google.android.collect, android.provider.ContactsContract.Intents.UI, android.provider.ContactsContract.SearchSnippetColumns, android.provider.ContactsContract.ProviderStatus, android.provider.ContactsContract.ContactCounts, android.content.IContentService, android.provider.ContactsContract.Intents.UI And many other imports, show errors saying it cannot be resolved. So my question is, why it shows this errors? Why I cant implement it without this errors? I use the Google APIs, I've created the project from an existing source code, but I dont know why this happens. Thanks.

    Read the article

  • Launch Android Default Email application through btn click

    - by Rony
    Hello Experts, I posted this query here, but as usual, noone knows / no replies http://www.anddev.org/viewtopic.php?p=41513#41513 How can I launch the android default mail application through the click of a button in my code? I would also like to know, how this can be done to launch the contacts list also. Any help in this regard is appreciated, Regards, Rony

    Read the article

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