Search Results

Search found 11551 results on 463 pages for 'android eve'.

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

  • 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

  • handling various frame layouts in android

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

    Read the article

  • imageview weights in linearlayout

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

    Read the article

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

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

    Read the article

  • What is wrong with this layout? Android

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

    Read the article

  • Android custom xml widget

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

    Read the article

  • [android] How to center buttons on screen horizontally and vertically plus equidistant apart?

    - by marc
    I've been racking my brain (android newbie here, so not hard to do) for awhile trying to figure out how to accomplish this: Desired Layout using a RelativeLayout or something other than AbsoluteLayout which is what this was created with. I'm coming from a Windows programming background where the device adjusts the 'absolute' positioning for you and GUI layout was a non-issue. The first layout works great in the emulator, but doesn't format for my Nexus One or any other screen that differs from the emulator size. I expected this because it's absolutely positioned, but haven't found a solution that will format correctly for different screen sizes. My goal is to have the layout work for different screen sizes and in portrait / landscape. Here's the Code that I'm currently using: [main.xml] <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <Button android:id="@+id/Button01" android:layout_width="188px" android:layout_height="100px" android:text="A" android:layout_y="50px" android:layout_x="65px" android:textSize="48sp"/> <Button android:id="@+id/Button02" android:layout_width="188px" android:layout_height="100px" android:text="B" android:layout_y="175px" android:layout_x="65px" android:textSize="48sp"/> <Button android:id="@+id/Button03" android:layout_width="188px" android:layout_height="100px" android:text="C" android:layout_y="300px" android:layout_x="65px" android:textSize="48sp"/> </AbsoluteLayout> Using tidbits from other questions here, I came up with this, it’s closer, but not there yet. <?xml version="1.0" encoding="utf-8"?> <TableLayout android:gravity="center" android:id="@+id/widget49" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" > <Button android:id="@+id/Button01" android:layout_width="0dip" android:layout_weight="1" android:text="A" android:textSize="48sp"/> <Button android:id="@+id/Button02" android:layout_width="0dip" android:layout_weight="1" android:text="B" android:textSize="48sp"/> <Button android:id="@+id/Button03" android:layout_width="0dip" android:layout_weight="1" android:text="C" android:textSize="48sp"/> </TableLayout> Here’s a picture of the TableLayout: Another Attempt Any help / guidance would be greatly appreciated.

    Read the article

  • Specifying Android project dependencies (in Eclipse)

    - by Henrik Gustafsson
    I have two Android projects, a 'library project' containing a custom layout, and an 'application project' containing an application which uses the layout. Everything seems to build and execute fine, except that the visual layout editor throws a ClassNotFoundException (which I assume is a bug in the plug-in), but when I try to start to make use of the attributes I defined for the custom layout in the xml, I can no longer build. That is; this works: <?xml version="1.0" encoding="utf-8"?> <se.fnord.android.layout.PredicateLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="asdfasdf" /> </se.fnord.android.layout.PredicateLayout> Whereas this does not: <?xml version="1.0" encoding="utf-8"?> <se.fnord.android.layout.PredicateLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fnord="http://schemas.android.com/apk/res/se.fnord.android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView fnord:layout_horizontalSpacing="1px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="asdfasdf" /> </se.fnord.android.layout.PredicateLayout> The build fails with a message from aapt: ERROR No resource identifier found for attribute 'layout_horizontalSpacing' in package 'se.fnord.android' The resource identifier does exist in the R-file and attrs.xml contained the library project, and if I put the layout code and resources directly in the application project everything works fine. The layout_horizontalSpacing attribute (and layout_verticalSpacing) is a custom attribute used in the PredicateLayout.LayoutParam class to specify the distance to the next widget. So far I've tried the standard eclipse ways by specifying project references and build path project dependencies. I was also told to try the tag in the application manifest, which did not help. So, what do I need to do for the references in the xml-file to work? I don't know if it's relevant, but the 'library' manifest looks like this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="se.fnord.android" android:versionCode="1" android:versionName="1.0.0"> </manifest> The 'application' manifest like this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="se.fnord.appname" android:versionCode="1" android:versionName="1.0.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".AppName" 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> (The 'PredicateLayout', btw, is a cleaned-up version of this).

    Read the article

  • custom listview adapter getView method being called multiple times, and in no coherent order

    - by edzillion
    I have a custom list adapter: class ResultsListAdapter extends ArrayAdapter<RecordItem> { in the overridden 'getView' method I do a print to check what position is and whether it is a convertView or not: @Override public View getView(int position, View convertView, ViewGroup parent) { System.out.println("getView " + position + " " + convertView); The output of this (when the list is first displayed, no user input as yet) 04-11 16:24:05.860: INFO/System.out(681): getView 0 null 04-11 16:24:29.020: INFO/System.out(681): getView 1 android.widget.RelativeLayout@43d415d8 04-11 16:25:48.070: INFO/System.out(681): getView 2 android.widget.RelativeLayout@43d415d8 04-11 16:25:49.110: INFO/System.out(681): getView 3 android.widget.RelativeLayout@43d415d8 04-11 16:25:49.710: INFO/System.out(681): getView 0 android.widget.RelativeLayout@43d415d8 04-11 16:25:50.251: INFO/System.out(681): getView 1 null 04-11 16:26:01.300: INFO/System.out(681): getView 2 null 04-11 16:26:02.020: INFO/System.out(681): getView 3 null 04-11 16:28:28.091: INFO/System.out(681): getView 0 null 04-11 16:37:46.180: INFO/System.out(681): getView 1 android.widget.RelativeLayout@43cff8f0 04-11 16:37:47.091: INFO/System.out(681): getView 2 android.widget.RelativeLayout@43cff8f0 04-11 16:37:47.730: INFO/System.out(681): getView 3 android.widget.RelativeLayout@43cff8f0 AFAIK, though I couldn't find it stated explicitly, getView() is only called for visible rows. Since my app starts with four visible rows at least the position numbers cycling from 0-3 makes sense. But the rest is a mess: Why is getview called for each row four times? Where are these convertViews coming from when I haven't scrolled yet? I did a bit of reseach, and without getting a good answer, I did notice that people were associating this issue with layout issues. So in case, here's the layout that contains the list: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/pageDetails" 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" android:drawSelectorOnTop="false" /> </LinearLayout> and the layout of each individual row: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="108dp" android:padding="4dp"> <ImageView android:id="@+id/thumb" android:layout_width="120dp" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginRight="8dp" android:src="@drawable/loading" /> <TextView android:id="@+id/price" android:layout_width="wrap_content" android:layout_height="18dp" android:layout_toRightOf="@id/thumb" android:layout_alignParentBottom="true" android:singleLine="true" /> <TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="18dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:paddingRight="4dp" android:singleLine="true" /> <TextView android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="17dp" android:layout_toRightOf="@id/thumb" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:paddingRight="4dp" android:layout_alignWithParentIfMissing="true" android:gravity="center" /> Thank you for your time

    Read the article

  • My android app crash before load main.xml

    - by Saverio Puccia
    my android app crash before load main.xml. This is the exception thrown java.lang.RuntimeException: Unable to resume activity...: java.lang.NullPointerException What happens? For completeness I enclose my manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="saverio.puccia.nfcauth" android:versionCode="1" android:versionName="1.0" > //permission <uses-sdk android:minSdkVersion="10" /> <uses-permission android:name="android.permission.NFC"></uses-permission> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> //main declaration <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".NFCAuthActivity" android:label="@string/app_name" > //intent filter declaration <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.NDEF_DISCOVER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> LOGCAT 06-25 11:03:23.670: E/AndroidRuntime(4323): FATAL EXCEPTION: main 06-25 11:03:23.670: E/AndroidRuntime(4323): java.lang.RuntimeException: Unable to resume activity {saverio.puccia.nfcauth/saverio.puccia.nfcauth.NFCAuthActivity}: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2456) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2484) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1998) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.access$600(ActivityThread.java:127) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Handler.dispatchMessage(Handler.java:99) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Looper.loop(Looper.java:137) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.main(ActivityThread.java:4507) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invokeNative(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invoke(Method.java:511) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 06-25 11:03:23.670: E/AndroidRuntime(4323): at dalvik.system.NativeStart.main(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): Caused by: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at saverio.puccia.nfcauth.NFCAuthActivity.onResume(NFCAuthActivity.java:103) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1157) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Activity.performResume(Activity.java:4539) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2446) 06-25 11:03:23.670: E/AndroidRuntime(4323): ... 12 more 06-25 11:03:23.670: W/ActivityManager(1998): Force finishing activity r.intent.getComponent().flattenToShortString()

    Read the article

  • Android ActivityGroup

    - by Vahag Vardanyan
    I know that ActivityGroup is in the "past", but I want to learn how to use it. So I write a simple TabHost, and want to show different activities using ActivityGroup. Here are the parts of code Player.java package player.org; import android.app.Activity; import android.app.TabActivity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TabHost; import android.widget.TabWidget; import android.widget.TextView; public class Player extends TabActivity { /** Called when the activity is first created. */ private MediaPlayer media=null; private SeekBar progress; private View play; private Progress p; TabHost tabhost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabs); Resources res=getResources(); //TabHost tabhost=(TabHost) findViewById(R.id.tabhost); // tabhost.setup(); tabhost=getTabHost(); TabHost.TabSpec spec; Intent intent; intent=new Intent(this,Progress.class); spec=tabhost.newTabSpec("now playing").setIndicator("Now playing", res.getDrawable(R.drawable.icon)) .setContent(intent); tabhost.addTab(spec); intent=new Intent(this,Group.class); spec=tabhost.newTabSpec("all_songs").setIndicator("All songs", res.getDrawable(R.drawable.songs)) .setContent(intent); tabhost.addTab(spec); //intent=new Intent(this,Progress.class); spec=tabhost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.icon)) .setContent(intent); tabhost.addTab(spec); spec=tabhost.newTabSpec("alboom").setIndicator("Alboom", res.getDrawable(R.drawable.icon)) .setContent(intent); tabhost.addTab(spec); tabhost.setCurrentTab(0); } } Group.java import android.os.Bundle; import android.view.View; public class Group extends ActivityGroup { @Override public void onCreate(Bundle savedInstanceStated) { super.onCreate(savedInstanceStated); View view = getLocalActivityManager().startActivity("AllSongs", new Intent(this, AllSongs.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); setContentView(view); } AllSongs.java package player.org; import java.util.ArrayList; import android.R.id; import android.app.ActivityGroup; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TabHost; public class AllSongs extends ListActivity{ ArrayList<String> listItem=new ArrayList<String>(); ArrayAdapter<String> adapter; ListView listView; //Player p; TabHost tab; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //p=new Player(); adapter=new ArrayAdapter<String>(this,R.layout.list_item,listItem); setListAdapter(adapter); listView=getListView(); listView.setTextFilterEnabled(true); listView.setOnItemClickListener(listener); addItem("vahag"); addItem("vahagvahag"); } private OnItemClickListener listener=new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Intent intent = new Intent(AllSongs.this,Progress.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); Group group= (Group) getParent(); View view=group.getLocalActivityManager().startActivity("Progress",intent).getDecorView(); setContentView(view); } }; public void addItem(String s) { listItem.add(s); adapter.notifyDataSetChanged(); } } and the Progress.java package player.org; import android.app.Activity; import android.app.ActivityGroup; import android.app.Dialog; import android.app.TabActivity; import android.content.Context; public class Progress extends Activity { // Called when the activity is first created. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } So, AllSongs.java try to change current activity with Progress activity, but when I press on list item, the Programm forsed closed, and logChat says "08-17 12:49:26.471: ERROR/AndroidRuntime(1500): java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'" I can't figure how to fix this problem, Can anyone helps?

    Read the article

  • android: which view should I use for showing text and image?

    - by Yang
    My app shows a list of items, where each line is an item title with its image asides, the line reserves 70% of space for text and 30% for image. Imagine what iphone app store looks like. Which view/layout combo is recommended for this purpose? I googled and find this article: http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/ Does this view sound good? <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:padding="6dip"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_marginRight="6dip" android:src="@drawable/icon" /> <TextView android:id="@+id/secondLine" android:layout_width="fill_parent" android:layout_height="26dip" android:layout_toRightOf="@id/icon" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:singleLine="true" android:ellipsize="marquee" android:text="Simple application that shows how to use RelativeLayout" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/icon" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_above="@id/secondLine" android:layout_alignWithParentIfMissing="true" android:gravity="center_vertical" android:text="My Application" />

    Read the article

  • Set width of Button in Android

    - by Mohit Deshpande
    How can I set a fixed width for an Android button? Everytime I try to set a fixed width it fills the current parent (the RelativeView). Here is my XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <EditText android:layout_height="wrap_content" android:editable="false" android:layout_width="fill_parent" android:id="@+id/output"></EditText> <Button android:layout_height="wrap_content" android:id="@+id/Button01" android:layout_below="@id/output" android:text="7" android:layout_width="wrap_content"></Button> <Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button02" android:layout_toRightOf="@+id/Button01" android:text="8"></Button> <Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button03" android:layout_toRightOf="@+id/Button02" android:text="9"></Button> </RelativeLayout> How would I give it a FIXED width?

    Read the article

  • Problems with calendar application on Android 2.1

    - by Rick
    Hi, I have compiled the android 2.1 source code and I can start the emulator. But I can't launch calendar application. Every time I tried to lauch the calendar application, it crashed. The log is as following: // CRASH: com.android.calendar (pid 272) // Short Msg: java.lang.NullPointerException // Long Msg: java.lang.NullPointerException // Build Label: android:generic/generic/generic/:2.1-update1/ERE27/eng.root.20100317.113135:eng/test-keys // Build Changelist: -1 // Build Time: 1268798948 // ID: // Tag: AndroidRuntime // java.lang.NullPointerException: // at com.android.providers.calendar.CalendarSyncAdapter.onAccountsChanged(CalendarSyncAdapter.java:1400) // at android.content.AbstractSyncableContentProvider$1.onAccountsUpdated(AbstractSyncableContentProvider.java:189) // at android.accounts.AccountManager$10.run(AccountManager.java:826) // at android.os.Handler.handleCallback(Handler.java:587) // at android.os.Handler.dispatchMessage(Handler.java:92) // at android.os.Looper.loop(Looper.java:123) // at android.app.ActivityThread.main(ActivityThread.java:4363) // at java.lang.reflect.Method.invokeNative(Method.java:-2) // at java.lang.reflect.Method.invoke(Method.java:521) // at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) // at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) // at dalvik.system.NativeStart.main(NativeStart.java:-2) has anyone met this problem, or any suggestions on how to fix it? Thanks very much!! Rick

    Read the article

  • Android NDK r4 san-angeles problem

    - by Goz
    Hi All, I'm starting to learn the android NDK and I've instantly come up against a problem. I'e built the tool chain (which took a LOT longer than I was expecting!!) and I've compiled the C++ code with no problems and now I'm trying to build the java code. Instantly I come up against a problem. There is a file "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="match_parent" android:layout_height="match_parent" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Hello World, DemoActivity" /> </LinearLayout> and I get the following errors: Description Resource Path Location Type error: Error: String types not allowed (at 'layout_height' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_height' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 7 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 7 Android AAPT Problem So I can see the problem lies in the fact that these "match_parent" strings are in there. Anyone know how to fix this?

    Read the article

  • Android TextView inside a ListView setTextHighlightColor() issue

    - by y ramesh rao
    I have Listview and Textview inside it now the thing is that i want to change the Text Color over the Selection of the that cell in the Listview but setting setTextHighlightColor of Textview is not giving this output I have tired setting a selector for this but that is not Heling too. Can this be solved. What might be causing the issue to populate. The Cell.xml is <ImageView android:id="@+id/thumbnail" android:layout_width="48dip" android:layout_height="48dip" android:layout_gravity="center_vertical" android:src="@drawable/icon" /> <TextView android:id="@+id/username" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/thumbnail" android:layout_alignParentTop="true" android:gravity="top" android:text="Username" android:textColor="@drawable/timeline_username_selector" /> <TextView android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginLeft="10px" android:text="31stMarch,2010" android:textColor="@drawable/timeline_username_selector" /> <TextView android:id="@+id/textTweet" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/username" android:layout_toRightOf="@id/thumbnail" android:layout_alignParentBottom="true" android:gravity="top" android:textColor="@drawable/timeline_tweet_selector" /> And the selector for the text color is something like this

    Read the article

  • Start Learning Android

    - by Shrewd Demon
    hi, i am a beginner with Android. I want to learn more about this new revolution. Kindly help me with links that will help me learn creating applications for Android. Please share if you have some simple source-code sites with you. Also show me a forum having high activity with Android users... thank you !

    Read the article

  • Android how to use checkedtextview

    - by erdomester
    the title speaks for itself. I am over several articles, topics and still haven't figured out how to use checkedtextview. I want a listview with checkable items. In the following code i am using a listview and populating it with a string array. But how to change it to checkedtextview? delete.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="4dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/linlay0" android:background="@color/list_bg"> <TextView android:id="@+id/TextView00" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#D8D8D8" android:textColor="#424242" android:gravity="center_horizontal|center_vertical" android:textSize="20px" android:height="40px" android:textStyle="bold" /> <ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> delete_lv.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center_vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/list_content" android:textColor="#222222" android:gravity="center" android:text="sample" android:layout_margin="4dip" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> Delete.java: public class Delete extends Activity { ListView lv1; ArrayAdapter<String> adapter1; private String lv_items[] = { "Android", "iPhone", "BlackBerry", "AndroidPeople", "J2ME", "Listview", "ArrayAdapter", "ListItem", "Us", "UK", "India" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.delete); TextView tv0 = (TextView)findViewById(R.id.TextView00); tv0.setText("Deletes"); lv1 = (ListView) findViewById(R.id.ListView01); adapter1 = new ArrayAdapter<String>(Delete.this,R.layout.list_black_text,R.id.list_content, lv_items); lv1.setAdapter(adapter1); adapter1.notifyDataSetChanged(); } }

    Read the article

  • android multiple activity declaration in manifest

    - by Brahadeesh
    Hi all. I have a main activity. From it, I am calling 2 other sub activities called FacebookLogin and Twitterlogin. I am using the following code in AndroidManufest.xml: ..... <activity android:name=".*****" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> </activity> <activity android:name=".FacebookLogin" android:label="string/app_name"> <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="image/*" /> </intent-filter> </activity> <activity android:name=".TwitterLogin" android:label="string/app_name"> <intent-filter> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:scheme="yourapp" android:host="twitt"></data> </intent-filter> </activity> ..... Am i doing it right? Should i nest the FacebookLogin and TwitterLogin activities in the main activity? The aforesaid 2 classes are in the package com.examples.. * is the same wherever used.

    Read the article

  • Android calculator with button click

    - by rynwtts
    I am trying to calculate a field named lblAnswer by adding values txtA + txtB. I am fairly new to the android development world and would like to know what is the best way of going about this. I have already added the necessarily edit fields to the GUI. I am now working in the java file to try and create the method. This method has been named doCalc. Here is what I have thus far. public void doCalc() { lblAnswer = txtA + txtB; } It has been suggested that I add more code here is the full code. Thank you for that suggestion. Here is the Java File. package com.example.wattsprofessional; import android.app.Activity; import android.os.Bundle; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } public void doCalc() { lblAnswer = txtA + txtB; Double.parseDouble(txtA.getText().toString()); lblAnswer.setText"t } and here is the xml file. <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" tools:context=".MainActivity" > <EditText android:id="@+id/txtA" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="40dp" android:ems="10" android:hint="Write Here" android:inputType="numberDecimal" > <requestFocus /> </EditText> <EditText android:id="@+id/txtB" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/txtA" android:layout_below="@+id/txtA" android:layout_marginTop="32dp" android:ems="10" android:hint="Second Here" android:inputType="numberDecimal" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/calculate" android:onClick="doCalc"/> <TextView android:id="@+id/lblAnswer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button1" android:layout_centerHorizontal="true" android:layout_marginTop="50dp" android:text="TextView" /> </RelativeLayout>

    Read the article

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