Search Results

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

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

  • [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

  • 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: Change the source of ImageView present in ListView

    - by Vivek
    Hi All, I have a ListView specified by list_item.xml Now I need to change the Image in my list inside onListItemClick. How to achieve this? //list_item.xml <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:id="@+id/img" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:id="@+id/txt" /> </LinearLayout> I have a Custom Adapter to populate my list. Code below is the adapter. public class MyCustomAdapter extends ArrayAdapter<String> { public MyCustomAdapter(Context context, int textViewResourceId, String[] objects) { super(context, textViewResourceId, objects); // TODO Auto-generated constructor stub } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutInflater inflater=getLayoutInflater(); View row=inflater.inflate(R.layout.list_item, parent, false); TextView label=(TextView)row.findViewById(R.id.txt); label.setText(Sounds[position]); ImageView icon=(ImageView)row.findViewById(R.id.img); icon.setMaxHeight(32); icon.setMaxWidth(32); icon.setPadding(2, 1, 5, 1); icon.setImageResource(R.drawable.play); return row; } } And in onCreate I do the following @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { setListAdapter(new MyCustomAdapter(this, R.layout.list_item, Sounds)); //Sounds --> String array } catch(Exception e) { e.printStackTrace(); } } Now when any row is selected, I need to change the image associated with the selected view. Your help is appreciated. Thanks.

    Read the article

  • Android ListView: how to select an item?

    - by mmo
    I am having trouble with a ListView I created: I want an item to get selected when I click on it. My code for this looks like: protected void onResume() { ... ListView lv = getListView(); lv.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long id) { Log.v(TAG, "onItemSelected(..., " + pos + ",...) => selected: " + getSelectedItemPosition()); } public void onNothingSelected(AdapterView<?> adapterView) { Log.v(TAG, "onNothingSelected(...) => selected: " + getSelectedItemPosition()); } }); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) { lv.setSelection(pos); Log.v(TAG, "onItemClick(..., " + pos + ",...) => selected: " + getSelectedItemPosition()); } }); ... } When I run this and click e.g. on the second item (i.e. pos=1) I get: 04-03 23:08:36.994: V/DisplayLists(663): onItemClick(..., 1,...) => selected: -1 i.e. even though the OnItemClickListener is called with the proper argument and calls a setSelection(1), there is no item selected (and hence also OnItemSelectedListener.onItemSelected(...) is never called) and getSelectedItemPosition() still yields -1 after the setSelection(1)-call. What am I missing? Michael PS.: My list does have =2 elements...

    Read the article

  • ListView and wrap_content

    - by gaiapac
    I want to create an activity with a ListView on the left and a TextView on the right, side by side. I write the following xml, but the ListView occupies the entire page and it don't worry about the wrap_content. Why? How can I resolve it? <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" > <ListView android:id="@+id/lv" android:layout_width="wrap_content" android:layout_height="match_parent" /> <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="match_parent" /> </LinearLayout> EDIT: my onCreate @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView lv = (ListView) findViewById(R.id.lv); String[] values = new String[] { "Test1", "Test2", "Test3", "Test4" }; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.left, R.id.tv1, values); lv.setAdapter(adapter); }

    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

  • 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 show listview.

    - by zaid
    i want to show this array as a listview in a new screen when a button is clicked. ArrayList<String> favorite = new ArrayList<String>(); this ListView is a small part of my class. i cant seem to figure out how to implement it with my code (i can figure out how to create a listview in a separate application, and set the onitemclicklistner just for that listview) i want to display that listview when. case R.id.ShowFavButton:

    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

  • Assigning ID to a Row in an Android ListView

    - by Chris
    I have a ListView. When an item on the ListView is tapped, it loads a SubView. I want to assign an ID to each row of the ListView, so I can pass that ID along to the SubView. How do I assign a specific ID to each row in the ListView? Here is how I am currently loading the ListView: setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, mArrayList));

    Read the article

  • Associate an Activity with an item in XML ListViews in Android

    - by John
    I have a ListView that is populated using an XML file. However, I want each item, when clicked, to start a new Activity related to that item. I understand how to use OnItemClick to start a Toast that shows the selected item's text. However, since the ListView is populated from an XML there is not a specific Id for each item in the list. So, how would I associate an Activity with each item in the ListView when the items do not have Ids?

    Read the article

  • Review - Professional Android Programming with Mono for Android and .NET/C#

    - by Wallym
    Mike Riley of Dev Pro Connections Magazine has a review of our Mono for Android book.  You can read the full review on their siteMono for Android has been available for more than a year. The documentation for the product is adequate and has been improving over time, but until recently, finding a good book about the technology was difficult. Such a constraint has been lifted thanks to Wiley's Professional Android Programming with Mono for Android and .NET/C#. Written under the Wrox imprint by several contributors (Wallace B. McClure, Nathan Blevins, John J. Croft, Jonathan Dick, and Chris Hardy), the book is one of the most comprehensive and helpful Mono for Android titles currently on the market. Please buy 8-10 copies of our book for the ones you love, they make great romantic gifts.

    Read the article

  • "Class ref in pre-verified class resolved to unexpected implementation" when running android tests i

    - by Mike
    I have a module that builds an app called MyApp. I have another that builds some testcases for that app, called MyAppTests. They both build their own APKs, and they both work fine from within my IDE. I'd like to build them using ant so that I can take advantage of continuous integration. Building the app module works fine. I'm having difficulty getting the Test module to compile and run. Using Christopher's tip from a previous question, I used android create test-project -p MyAppTests -m ../MyApp -n MyAppTests to create the necessary build files to build and run my test project. This seems to work great (once I remove an unnecessary test case that it constructed for me and revert my AndroidManifest.xml to the one I was using before it got replaced by android create), but I have two problems. The first problem: The project doesn't compile because it's missing libraries. $ ant run-tests Buildfile: build.xml [setup] Project Target: Google APIs [setup] Vendor: Google Inc. [setup] Platform Version: 1.6 [setup] API level: 4 [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. -install-tested-project: [setup] Project Target: Google APIs [setup] Vendor: Google Inc. [setup] Platform Version: 1.6 [setup] API level: 4 [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. -compile-tested-if-test: -dirs: [echo] Creating output directories if needed... -resource-src: [echo] Generating R.java / Manifest.java from the resources... -aidl: [echo] Compiling aidl files into Java classes... compile: [javac] Compiling 1 source file to /Users/mike/Projects/myapp/android/MyApp/bin/classes -dex: [echo] Converting compiled files and external libraries into /Users/mike/Projects/myapp/android/MyApp/bin/classes.dex... [echo] -package-resources: [echo] Packaging resources [aaptexec] Creating full resource package... -package-debug-sign: [apkbuilder] Creating MyApp-debug-unaligned.apk and signing it with a debug key... [apkbuilder] Using keystore: /Users/mike/.android/debug.keystore debug: [echo] Running zip align on final apk... [echo] Debug Package: /Users/mike/Projects/myapp/android/MyApp/bin/MyApp-debug.apk install: [echo] Installing /Users/mike/Projects/myapp/android/MyApp/bin/MyApp-debug.apk onto default emulator or device... [exec] 1567 KB/s (288354 bytes in 0.179s) [exec] pkg: /data/local/tmp/MyApp-debug.apk [exec] Success -compile-tested-if-test: -dirs: [echo] Creating output directories if needed... [mkdir] Created dir: /Users/mike/Projects/myapp/android/MyAppTests/gen [mkdir] Created dir: /Users/mike/Projects/myapp/android/MyAppTests/bin [mkdir] Created dir: /Users/mike/Projects/myapp/android/MyAppTests/bin/classes -resource-src: [echo] Generating R.java / Manifest.java from the resources... -aidl: [echo] Compiling aidl files into Java classes... compile: [javac] Compiling 5 source files to /Users/mike/Projects/myapp/android/MyAppTests/bin/classes [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:4: package roboguice.test does not exist [javac] import roboguice.test.RoboUnitTestCase; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:8: package com.google.gson does not exist [javac] import com.google.gson.JsonElement; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:9: package com.google.gson does not exist [javac] import com.google.gson.JsonParser; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:11: cannot find symbol [javac] symbol: class RoboUnitTestCase [javac] public class GsonTest extends RoboUnitTestCase<MyApplication> { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:6: package roboguice.test does not exist [javac] import roboguice.test.RoboUnitTestCase; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:7: package roboguice.util does not exist [javac] import roboguice.util.RoboLooperThread; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:11: package com.google.gson does not exist [javac] import com.google.gson.JsonObject; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:15: cannot find symbol [javac] symbol: class RoboUnitTestCase [javac] public class HttpTest extends RoboUnitTestCase<MyApplication> { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/LinksTest.java:4: package roboguice.test does not exist [javac] import roboguice.test.RoboUnitTestCase; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/LinksTest.java:12: cannot find symbol [javac] symbol: class RoboUnitTestCase [javac] public class LinksTest extends RoboUnitTestCase<MyApplication> { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:4: package roboguice.test does not exist [javac] import roboguice.test.RoboUnitTestCase; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:5: package roboguice.util does not exist [javac] import roboguice.util.RoboAsyncTask; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:6: package roboguice.util does not exist [javac] import roboguice.util.RoboLooperThread; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:12: cannot find symbol [javac] symbol: class RoboUnitTestCase [javac] public class SafeAsyncTest extends RoboUnitTestCase<MyApplication> { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectResource': class file for roboguice.inject.InjectResource not found [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectResource' [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectView': class file for roboguice.inject.InjectView not found [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectView' [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectView' [javac] /Users/mike/Projects/myapp/android/MyApp/bin/classes/com/myapp/activity/Stories.class: warning: Cannot find annotation method 'value()' in type 'roboguice.inject.InjectView' [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:15: cannot find symbol [javac] symbol : class JsonParser [javac] location: class com.myapp.test.GsonTest [javac] final JsonParser parser = new JsonParser(); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:15: cannot find symbol [javac] symbol : class JsonParser [javac] location: class com.myapp.test.GsonTest [javac] final JsonParser parser = new JsonParser(); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:18: cannot find symbol [javac] symbol : class JsonElement [javac] location: class com.myapp.test.GsonTest [javac] final JsonElement e = parser.parse(s); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/GsonTest.java:20: cannot find symbol [javac] symbol : class JsonElement [javac] location: class com.myapp.test.GsonTest [javac] final JsonElement e2 = parser.parse(s2); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:19: cannot find symbol [javac] symbol : method getInstrumentation() [javac] location: class com.myapp.test.HttpTest [javac] assertEquals("MyApp", getInstrumentation().getTargetContext().getResources().getString(com.myapp.R.string.app_name)); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:62: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.HttpTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:82: cannot find symbol [javac] symbol : method assertTrue(java.lang.String,boolean) [javac] location: class com.myapp.test.HttpTest [javac] assertTrue(result[0], result[0].contains("Search")); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:87: cannot find symbol [javac] symbol : class JsonObject [javac] location: class com.myapp.test.HttpTest [javac] final JsonObject[] result = {null}; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:90: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.HttpTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:117: cannot find symbol [javac] symbol : class JsonObject [javac] location: class com.myapp.test.HttpTest [javac] final JsonObject[] result = {null}; [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/HttpTest.java:120: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.HttpTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/LinksTest.java:27: cannot find symbol [javac] symbol : method assertTrue(boolean) [javac] location: class com.myapp.test.LinksTest [javac] assertTrue(m.matches()); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/LinksTest.java:28: cannot find symbol [javac] symbol : method assertEquals(java.lang.String,java.lang.String) [javac] location: class com.myapp.test.LinksTest [javac] assertEquals( map.get(url), m.group(1) ); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:19: cannot find symbol [javac] symbol : method getInstrumentation() [javac] location: class com.myapp.test.SafeAsyncTest [javac] assertEquals("MyApp", getInstrumentation().getTargetContext().getString(com.myapp.R.string.app_name)); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:27: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.SafeAsyncTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:65: cannot find symbol [javac] symbol : method assertEquals(com.myapp.test.SafeAsyncTest.State,com.myapp.test.SafeAsyncTest.State) [javac] location: class com.myapp.test.SafeAsyncTest [javac] assertEquals(State.TEST_SUCCESS,state[0]); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:74: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.SafeAsyncTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:105: cannot find symbol [javac] symbol : method assertEquals(com.myapp.test.SafeAsyncTest.State,com.myapp.test.SafeAsyncTest.State) [javac] location: class com.myapp.test.SafeAsyncTest [javac] assertEquals(State.TEST_SUCCESS,state[0]); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:113: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.SafeAsyncTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:144: cannot find symbol [javac] symbol : method assertEquals(com.myapp.test.SafeAsyncTest.State,com.myapp.test.SafeAsyncTest.State) [javac] location: class com.myapp.test.SafeAsyncTest [javac] assertEquals(State.TEST_SUCCESS,state[0]); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:154: cannot find symbol [javac] symbol : class RoboLooperThread [javac] location: class com.myapp.test.SafeAsyncTest [javac] new RoboLooperThread() { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java:187: cannot find symbol [javac] symbol : method assertEquals(com.myapp.test.SafeAsyncTest.State,com.myapp.test.SafeAsyncTest.State) [javac] location: class com.myapp.test.SafeAsyncTest [javac] assertEquals(State.TEST_SUCCESS,state[0]); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/StoriesTest.java:11: cannot access roboguice.activity.GuiceListActivity [javac] class file for roboguice.activity.GuiceListActivity not found [javac] public class StoriesTest extends ActivityUnitTestCase<Stories> { [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/StoriesTest.java:21: cannot access roboguice.application.GuiceApplication [javac] class file for roboguice.application.GuiceApplication not found [javac] setApplication( new MyApplication( getInstrumentation().getTargetContext() ) ); [javac] ^ [javac] /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/StoriesTest.java:22: incompatible types [javac] found : com.myapp.activity.Stories [javac] required: android.app.Activity [javac] final Activity activity = startActivity(intent, null, null); [javac] ^ [javac] 39 errors [javac] 6 warnings BUILD FAILED /opt/local/android-sdk-mac/platforms/android-1.6/templates/android_rules.xml:248: Compile failed; see the compiler error output for details. Total time: 24 seconds That's not a hard problem to solve. I'm not sure it's the right thing to do, but I copied the missing libraries (roboguice and gson) from the MyApp/libs directory to the MyAppTests/libs directory and everything seems to compile fine. But that leads to the second problem, which I'm currently stuck on. The tests compile fine but they won't run: $ cp ../MyApp/libs/gson-r538.jar libs/ $ cp ../MyApp/libs/roboguice-1.1-SNAPSHOT.jar libs/ 0 10:23 /Users/mike/Projects/myapp/android/MyAppTests $ ant run-testsBuildfile: build.xml [setup] Project Target: Google APIs [setup] Vendor: Google Inc. [setup] Platform Version: 1.6 [setup] API level: 4 [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. -install-tested-project: [setup] Project Target: Google APIs [setup] Vendor: Google Inc. [setup] Platform Version: 1.6 [setup] API level: 4 [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. -compile-tested-if-test: -dirs: [echo] Creating output directories if needed... -resource-src: [echo] Generating R.java / Manifest.java from the resources... -aidl: [echo] Compiling aidl files into Java classes... compile: [javac] Compiling 1 source file to /Users/mike/Projects/myapp/android/MyApp/bin/classes -dex: [echo] Converting compiled files and external libraries into /Users/mike/Projects/myapp/android/MyApp/bin/classes.dex... [echo] -package-resources: [echo] Packaging resources [aaptexec] Creating full resource package... -package-debug-sign: [apkbuilder] Creating MyApp-debug-unaligned.apk and signing it with a debug key... [apkbuilder] Using keystore: /Users/mike/.android/debug.keystore debug: [echo] Running zip align on final apk... [echo] Debug Package: /Users/mike/Projects/myapp/android/MyApp/bin/MyApp-debug.apk install: [echo] Installing /Users/mike/Projects/myapp/android/MyApp/bin/MyApp-debug.apk onto default emulator or device... [exec] 1396 KB/s (288354 bytes in 0.201s) [exec] pkg: /data/local/tmp/MyApp-debug.apk [exec] Success -compile-tested-if-test: -dirs: [echo] Creating output directories if needed... -resource-src: [echo] Generating R.java / Manifest.java from the resources... -aidl: [echo] Compiling aidl files into Java classes... compile: [javac] Compiling 5 source files to /Users/mike/Projects/myapp/android/MyAppTests/bin/classes [javac] Note: /Users/mike/Projects/myapp/android/MyAppTests/src/com/myapp/test/SafeAsyncTest.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. -dex: [echo] Converting compiled files and external libraries into /Users/mike/Projects/myapp/android/MyAppTests/bin/classes.dex... [echo] -package-resources: [echo] Packaging resources [aaptexec] Creating full resource package... -package-debug-sign: [apkbuilder] Creating MyAppTests-debug-unaligned.apk and signing it with a debug key... [apkbuilder] Using keystore: /Users/mike/.android/debug.keystore debug: [echo] Running zip align on final apk... [echo] Debug Package: /Users/mike/Projects/myapp/android/MyAppTests/bin/MyAppTests-debug.apk install: [echo] Installing /Users/mike/Projects/myapp/android/MyAppTests/bin/MyAppTests-debug.apk onto default emulator or device... [exec] 1227 KB/s (94595 bytes in 0.075s) [exec] pkg: /data/local/tmp/MyAppTests-debug.apk [exec] Success run-tests: [echo] Running tests ... [exec] [exec] android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:INSTRUMENTATION_RESULT: shortMsg=Class ref in pre-verified class resolved to unexpected implementation [exec] INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation [exec] INSTRUMENTATION_CODE: 0 BUILD SUCCESSFUL Total time: 38 seconds Any idea what's causing the "Class ref in pre-verified class resolved to unexpected implementation" error?

    Read the article

  • Problem with Android emulator

    - by benasio
    Projects do not run, on screen emulator only "ANDROID" WinXP pro SP3/Eclipse Galileo java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing) My actions: 1.Start the emulator(Platform:2.1 API Level:7), wait until the window DDMS status will change to ONLINE 2.Launches helloandroid from examples - Run as Android Application Console: Android Launch! [2010-05-03 21:44:34 - HelloAndroid] adb is running normally. [2010-05-03 21:44:34 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch [2010-05-03 21:44:34 - HelloAndroid] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'my_vm' [2010-05-03 21:44:34 - HelloAndroid] WARNING: Application does not specify an API level requirement! [2010-05-03 21:44:34 - HelloAndroid] Device API version is 7 (Android 2.1) [2010-05-03 21:44:34 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554' [2010-05-03 21:44:35 - HelloAndroid] Installing HelloAndroid.apk... [2010-05-03 21:45:07 - HelloAndroid] Success! [2010-05-03 21:45:08 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device [2010-05-03 21:45:28 - HelloAndroid] ActivityManager: DDM dispatch reg wait timeout [2010-05-03 21:45:28 - HelloAndroid] ActivityManager: Can't dispatch DDM chunk 52454151: no handler defined [2010-05-03 21:45:28 - HelloAndroid] ActivityManager: Can't dispatch DDM chunk 48454c4f: no handler defined [2010-05-03 21:45:28 - HelloAndroid] ActivityManager: Can't dispatch DDM chunk 46454154: no handler defined [2010-05-03 21:45:28 - HelloAndroid] ActivityManager: Can't dispatch DDM chunk 4d505251: no handler defined [2010-05-03 21:45:52 - HelloAndroid] Device not ready. Waiting 3 seconds before next attempt. [2010-05-03 21:45:52 - HelloAndroid] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running? [2010-05-03 21:45:55 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device [2010-05-03 21:46:11 - HelloAndroid] ActivityManager: DDM dispatch reg wait timeout ...... DDMS console (only errors and warnings) 05-03 17:43:52.437: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test2' (No such file or directory) 05-03 17:43:52.437: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory) 05-03 17:43:52.437: ERROR/vold(26): Error opening switch name path '/sys/class/switch/test' (No such file or directory) 05-03 17:43:52.437: ERROR/vold(26): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory) 05-03 17:48:34.036: WARN/Zygote(29): Preloaded drawable resource #0x1080093 (res/drawable-mdpi/sym_def_app_icon.png) that varies with configuration!! 05-03 17:48:34.406: WARN/Zygote(29): Preloaded drawable resource #0x1080002 (res/drawable-mdpi/arrow_down_float.png) that varies with configuration!! 05-03 17:48:35.836: WARN/Zygote(29): Preloaded drawable resource #0x10800b4 (res/drawable/btn_check.xml) that varies with configuration!! 05-03 17:48:36.076: WARN/Zygote(29): Preloaded drawable resource #0x10800b7 (res/drawable-mdpi/btn_check_label_background.9.png) that varies with configuration!! 05-03 17:48:36.106: WARN/Zygote(29): Preloaded drawable resource #0x10800b8 (res/drawable-mdpi/btn_check_off.png) that varies with configuration!! 05-03 17:48:36.147: WARN/Zygote(29): Preloaded drawable resource #0x10800bd (res/drawable-mdpi/btn_check_on.png) that varies with configuration!! 05-03 17:48:36.437: WARN/Zygote(29): Preloaded drawable resource #0x1080004 (res/drawable/btn_default.xml) that varies with configuration!! 05-03 17:48:36.716: WARN/Zygote(29): Preloaded drawable resource #0x1080005 (res/drawable/btn_default_small.xml) that varies with configuration!! 05-03 17:48:36.966: WARN/Zygote(29): Preloaded drawable resource #0x1080006 (res/drawable/btn_dropdown.xml) that varies with configuration!! 05-03 17:48:37.326: WARN/Zygote(29): Preloaded drawable resource #0x1080008 (res/drawable/btn_plus.xml) that varies with configuration!! 05-03 17:48:37.707: WARN/Zygote(29): Preloaded drawable resource #0x1080007 (res/drawable/btn_minus.xml) that varies with configuration!! 05-03 17:48:38.057: WARN/Zygote(29): Preloaded drawable resource #0x1080009 (res/drawable/btn_radio.xml) that varies with configuration!! 05-03 17:48:38.776: WARN/Zygote(29): Preloaded drawable resource #0x108000a (res/drawable/btn_star.xml) that varies with configuration!! 05-03 17:48:39.327: WARN/Zygote(29): Preloaded drawable resource #0x1080125 (res/drawable/btn_toggle.xml) that varies with configuration!! 05-03 17:48:39.416: WARN/Zygote(29): Preloaded drawable resource #0x1080187 (res/drawable-mdpi/ic_emergency.png) that varies with configuration!! 05-03 17:48:39.506: WARN/Zygote(29): Preloaded drawable resource #0x1080012 (res/drawable-mdpi/divider_horizontal_bright.9.png) that varies with configuration!! 05-03 17:48:39.576: WARN/Zygote(29): Preloaded drawable resource #0x1080014 (res/drawable-mdpi/divider_horizontal_dark.9.png) that varies with configuration!! 05-03 17:48:40.126: WARN/Zygote(29): Preloaded drawable resource #0x1080016 (res/drawable/edit_text.xml) that varies with configuration!! 05-03 17:48:40.507: WARN/Zygote(29): Preloaded drawable resource #0x1080161 (res/drawable/expander_group.xml) that varies with configuration!! 05-03 17:48:41.036: WARN/Zygote(29): Preloaded drawable resource #0x1080062 (res/drawable/list_selector_background.xml) that varies with configuration!! 05-03 17:48:41.177: WARN/Zygote(29): Preloaded drawable resource #0x1080217 (res/drawable-mdpi/menu_background.9.png) that varies with configuration!! 05-03 17:48:41.256: WARN/Zygote(29): Preloaded drawable resource #0x1080218 (res/drawable-mdpi/menu_background_fill_parent_width.9.png) that varies with configuration!! 05-03 17:48:41.567: WARN/Zygote(29): Preloaded drawable resource #0x1080219 (res/drawable/menu_selector.xml) that varies with configuration!! 05-03 17:48:41.706: WARN/Zygote(29): Preloaded drawable resource #0x1080224 (res/drawable-mdpi/panel_background.9.png) that varies with configuration!! 05-03 17:48:41.849: WARN/Zygote(29): Preloaded drawable resource #0x108022e (res/drawable-mdpi/popup_bottom_bright.9.png) that varies with configuration!! 05-03 17:48:42.026: WARN/Zygote(29): Preloaded drawable resource #0x108022f (res/drawable-mdpi/popup_bottom_dark.9.png) that varies with configuration!! 05-03 17:48:42.156: WARN/Zygote(29): Preloaded drawable resource #0x1080230 (res/drawable-mdpi/popup_bottom_medium.9.png) that varies with configuration!! 05-03 17:48:42.276: WARN/Zygote(29): Preloaded drawable resource #0x1080231 (res/drawable-mdpi/popup_center_bright.9.png) that varies with configuration!! 05-03 17:48:42.376: WARN/Zygote(29): Preloaded drawable resource #0x1080232 (res/drawable-mdpi/popup_center_dark.9.png) that varies with configuration!! 05-03 17:48:42.507: WARN/Zygote(29): Preloaded drawable resource #0x1080235 (res/drawable-mdpi/popup_full_dark.9.png) that varies with configuration!! 05-03 17:48:42.606: WARN/Zygote(29): Preloaded drawable resource #0x1080238 (res/drawable-mdpi/popup_top_bright.9.png) that varies with configuration!! 05-03 17:48:42.696: WARN/Zygote(29): Preloaded drawable resource #0x1080239 (res/drawable-mdpi/popup_top_dark.9.png) that varies with configuration!! 05-03 17:48:42.946: WARN/Zygote(29): Preloaded drawable resource #0x108006d (res/drawable/progress_indeterminate_horizontal.xml) that varies with configuration!! 05-03 17:48:43.076: WARN/Zygote(29): Preloaded drawable resource #0x108023f (res/drawable/progress_small.xml) that varies with configuration!! 05-03 17:48:43.456: WARN/Zygote(29): Preloaded drawable resource #0x1080240 (res/drawable/progress_small_titlebar.xml) that varies with configuration!! 05-03 17:48:43.957: WARN/Zygote(29): Preloaded drawable resource #0x1080262 (res/drawable-mdpi/scrollbar_handle_horizontal.9.png) that varies with configuration!! 05-03 17:48:44.036: WARN/Zygote(29): Preloaded drawable resource #0x1080263 (res/drawable-mdpi/scrollbar_handle_vertical.9.png) that varies with configuration!! 05-03 17:48:44.176: WARN/Zygote(29): Preloaded drawable resource #0x1080071 (res/drawable/spinner_dropdown_background.xml) that varies with configuration!! 05-03 17:48:44.317: WARN/Zygote(29): Preloaded drawable resource #0x1080326 (res/drawable-mdpi/title_bar_shadow.9.png) that varies with configuration!! 05-03 17:48:44.496: WARN/Zygote(29): Preloaded drawable resource #0x10801c6 (res/drawable-mdpi/indicator_code_lock_drag_direction_green_up.png) that varies with configuration!! 05-03 17:48:44.607: WARN/Zygote(29): Preloaded drawable resource #0x10801c7 (res/drawable-mdpi/indicator_code_lock_drag_direction_red_up.png) that varies with configuration!! 05-03 17:48:45.956: WARN/Zygote(29): Preloaded drawable resource #0x10801c8 (res/drawable-mdpi/indicator_code_lock_point_area_default.png) that varies with configuration!! 05-03 17:48:46.407: WARN/Zygote(29): Preloaded drawable resource #0x10801c9 (res/drawable-mdpi/indicator_code_lock_point_area_green.png) that varies with configuration!! 05-03 17:48:46.696: WARN/Zygote(29): Preloaded drawable resource #0x10801ca (res/drawable-mdpi/indicator_code_lock_point_area_red.png) that varies with configuration!! 05-03 17:48:56.307: ERROR/BatteryService(170): usbOnlinePath not found 05-03 17:48:56.336: ERROR/BatteryService(170): batteryVoltagePath not found 05-03 17:48:56.350: ERROR/BatteryService(170): batteryTemperaturePath not found 05-03 17:48:56.696: ERROR/SurfaceFlinger(170): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake 05-03 17:48:57.847: WARN/SurfaceFlinger(170): ro.sf.lcd_density not defined, using 160 dpi by default. 05-03 17:49:02.116: WARN/UsageStats(170): Usage stats version changed; dropping 05-03 17:49:05.036: WARN/zipro(182): Unable to open zip '/data/local/bootanimation.zip': No such file or directory 05-03 17:49:06.297: WARN/zipro(182): Unable to open zip '/system/media/bootanimation.zip': No such file or directory 05-03 17:49:50.637: WARN/PackageManager(170): Running ENG build: no pre-dexopt! 05-03 17:53:59.196: WARN/PackageManager(170): Unknown permission com.google.android.providers.gmail.permission.WRITE_GMAIL in package com.android.settings 05-03 17:53:59.238: WARN/PackageManager(170): Unknown permission com.google.android.providers.gmail.permission.READ_GMAIL in package com.android.settings 05-03 17:53:59.286: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH in package com.android.settings 05-03 17:53:59.517: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH in package com.android.providers.contacts 05-03 17:53:59.656: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH.cp in package com.android.providers.contacts 05-03 17:53:59.717: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH.mail in package com.android.contacts 05-03 17:53:59.796: WARN/PackageManager(170): Unknown permission android.permission.ADD_SYSTEM_SERVICE in package com.android.phone 05-03 17:54:00.126: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH in package com.android.development 05-03 17:54:00.206: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES in package com.android.development 05-03 17:54:00.206: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH.YouTubeUser in package com.android.development 05-03 17:54:00.237: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD in package com.android.development 05-03 17:54:00.258: WARN/PackageManager(170): Unknown permission com.google.android.googleapps.permission.GOOGLE_AUTH in package com.android.browser 05-03 17:54:25.456: WARN/ResourceType(170): Resources don't contain package for resource number 0x7f0700e5 05-03 17:54:25.486: WARN/ResourceType(170): Resources don't contain package for resource number 0x7f020031 05-03 17:54:25.536: WARN/ResourceType(170): Resources don't contain package for resource number 0x7f020030 05-03 17:54:25.576: WARN/ResourceType(170): Resources don't contain package for resource number 0x7f050000 05-03 17:54:38.708: WARN/SharedBufferStack(182): waitForCondition(LockCondition) timed out (identity=0, status=0). CPU may be pegged. trying again.

    Read the article

  • How to implement Google Maps new version of API v2

    - by bapatla
    Hi every one I came to know that google maps has deprecated its previous version API v1 and introduced a new version of google maps API v2. I tried out one example by following some links in google any how i am pretty sure that i got the api key correctly by providing the exact hash key code and managed to get the correct api key. Now i managed to write some code as well but when i tried to execute the code i am getting the errors please help me to solve this here is my code and i even tried the sample codes provided by google play services an i got the same problem this is the sample that i have done by referring some links in google main activity package com.example.apv; 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.MarkerOptions; import android.os.Bundle; import android.app.Activity; import android.app.FragmentManager; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FragmentManager fragmentManager = getFragmentManager(); MapFragment mapFragment = (MapFragment) fragmentManager.findFragmentById(R.id.map); GoogleMap googleMap = mapFragment.getMap(); LatLng sfLatLng = new LatLng(37.7750, -122.4183); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.addMarker(new MarkerOptions() .position(sfLatLng) .title("San Francisco") .snippet("Population: 776733") .icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_AZURE))); googleMap.getUiSettings().setCompassEnabled(true); googleMap.getUiSettings().setZoomControlsEnabled(true); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(sfLatLng, 10)); } } main.xml <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment"/> and finally my manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.apv" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> <permission android:name="com.codebybrian.mapsample.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <!--Required permissions--> permission oid:name="com.codebybrian.mapsample.permission.MAPS_RECEIVE"/> <!--Used by the API to download map tiles from Google Maps servers: --> <uses-permission android:name="android.permission.INTERNET"/> <!--Allows the API to access Google web-based services: --> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!--Optional permissions--> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!--Version 2 of the Google Maps Android API requires OpenGL ES version 2 --> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name=".MyMapActivity" 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="AZzaSSsBmhi4dXoKSylGGmjkQ5Jev9UdAJBjk"/> </application> </manifest> i run my application in emulator of version 4.2 and api level of 17 i got following error 12-17 10:06:52.590: E/Trace(826): error opening trace file: No such file or directory (2) 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.680: I/ActivityThread(826): Pub com.google.android.gms.plus;com.google.android.gms.plus.action: com.google.android.gms.plus.provider.PlusProvider 12-17 10:06:52.740: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.740: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.760: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 later i came to know that these version cant execute in emulator so i tried executing it with two devices one is Sony xperia u of android version 2.3.7 and Samsung galaxy tab of android version 4.1.1 and these are my outputs 12-17 14:37:02.468: D/AndroidRuntime(7636): Shutting down VM 12-17 14:37:02.468: W/dalvikvm(7636): threadid=1: thread exiting with uncaught exception (group=0x41f672a0) 12-17 14:37:02.476: E/AndroidRuntime(7636): FATAL EXCEPTION: main 12-17 14:37:02.476: E/AndroidRuntime(7636): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.apv/com.example.apv.MyMapActivity}: java.lang.ClassNotFoundException: com.example.apv.MyMapActivity 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2021) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.access$600(ActivityThread.java:140) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.os.Handler.dispatchMessage(Handler.java:99) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.os.Looper.loop(Looper.java:137) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.main(ActivityThread.java:4895) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.reflect.Method.invokeNative(Native Method) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.reflect.Method.invoke(Method.java:511) 12-17 14:37:02.476: E/AndroidRuntime(7636): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller .run(ZygoteInit.java:994) 12-17 14:37:02.476: E/AndroidRuntime(7636): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) 12-17 14:37:02.476: E/AndroidRuntime(7636): at dalvik.system.NativeStart.main(Native Method) 12-17 14:37:02.476: E/AndroidRuntime(7636): Caused by: java.lang.ClassNotFoundException: com.example.apv.MyMapActivity 12-17 14:37:02.476: E/AndroidRuntime(7636): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.Instrumentation.newActivity(Instrumentation.java:1068) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2012) 12-17 14:37:02.476: E/AndroidRuntime(7636): ... 11 more could any one please suggest me to how to get this done and give me some links of new version API v2 tutorials of google maps and some examples links please help me

    Read the article

  • ListView OnItemClickListener Not Responding?

    - by GuyNoir
    I've looked everywhere for a solution to this, but I can't figure out how to implement it. My OnItemClickListener was disabled somehow on my ListView rows, because I have an ImageButton in the row layout, which takes over the focus. There have been numerous questions I've found, but none of them have gotten me anywhere. I've checked this question, but I couldn't really make heads or tails of it. I just need a way to get the rows clickable so that I can detect when a row is pressed. Long press and focus work fine.

    Read the article

  • Odd visual issue with ListView item layout with two pressable pieces

    - by jnylen
    I wanted to make a ListView where the items have two pressable pieces, like the layouts that show up in a couple of places in the stock Android phone/contacts application: I have the layout working fine, including handling events from each piece separately, except for a visual issue when the smaller piece is pressed. In my application the smaller piece only gets a small ellipse for the background when it is pressed, like this: Note that is actually not my application - that is NubDial, but my application has the same problem. Since NubDial uses the exact same XML layout as the phone app, I'm not sure how relevant the list item layouts are, but here they are anyway: Contacts list: contacts_list_item.xml NubDial: contacts_list_item.xml Does anybody know what might be happening there?

    Read the article

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