Search Results

Search found 17553 results on 703 pages for 'android sdk'.

Page 15/703 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Why not standard Android emulators?

    - by Gerry
    I'm new to Android, but have published iphone and bberry apps. I see that I have to create an emulator using the SDK, before I can write and test an app. Why are there no default emulators? Why not at least a Nexus one, or HTC hero emulator shipped with the product? Sure its supposed to be flexible, but why not make it easy to create hello world and play around with a virtual Android phone? Both blackberry and iphone come with default simulators when you download the sdk. Thanks, Gerry

    Read the article

  • Can I use android.os.* libraries in a standalone project?

    - by medicdave
    I'm trying to develop an external library (not sure if that's the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I've added the appropriate android.jar file to the build path, and everything is happy both while editing and upon compilation. However, when I use Android's Handler and Message classes (android.os.Handler, android.os.Message) for inter-thread communication, I get exceptions unless I'm running within an Android app, on the emulator or a device. I can no longer test my library in a "standalone" way without having to go through a running Android target. Is there any way for me to include these two Android classes and still be able to test my library standalone? Do I need to have the Android source available? Or would it require some sort of conditional compilation hand-waving?

    Read the article

  • How to publish paid Android apps if you're not from US/UK

    - by Sheikh Aman
    I was pretty excited while creating one of my apps but as it turns out you can't actually sign up for Google Checkout if you don't live either in the USA or in the UK. And since Google Checkout is the only way Android Market will pay you, all my efforts seem to be going in vain. So because I live in India, I can't sell my apps. I tried contacting Google by various means on this, but haven't got any response so far. I tried searching the web as well just to find out that one can't be paid via any other way. I am pretty sure that many people here might have gone through the same problem. How did you solve it? I have a PayPal account and an AdSense account as well. Can they help in any way? And if nothing works out, how am I supposed to be selling my app?

    Read the article

  • Databinding a ListView with Mono for Android

    - by Wallym
    The world lives on data. Data is all around us and in many forms: salespeople need to know what customers have spent; twitter users want to know what their friends are saying. How do we as developers present data to a user? In Android, we use the ListView in its various forms. In this article, we'll look at using a ListView, how we can work with it, then discuss what we need to do to overcome some of the challenges in a mobile environment.Article url: http://visualstudiomagazine.com/articles/2012/09/14/databind-a-listview.aspx

    Read the article

  • Why is Android VM-based? [closed]

    - by adib
    By about 2004, it was clear that ARM is the clear winner for mobile CPUs, beating out MIPS, SH3, and DragonBall. PocketPC (Windows Mobile) applications was natively-compiled (at least most of them - except for .NET compact and its competitors). Likewise, Apple's iOS (named iPhone OS at the time) prefers natively-compiled applications. Then why Android chose a virtual machine based system stack? (the Dalvik VM). Wouldn't it be simpler to just compile applications down to ARM code using GCJ or something? Is the decision influenced by the J2ME-way of doing things, or was just because it's "cool"? Perhaps like most things Java, the culture that prefers multiple levels of indirection and abstractions, they just added another layer of abstraction for "just in case"?

    Read the article

  • Android SDK Manager and AVD Manager doesn't have the correct information and fails to update on Ubun

    - by Johan Carlsson
    I'm trying to install Android SDK on Ubuntu but fail when I try to use the SDK Manager and AVD Manager to install Android platforms. I've downloaded: android-sdk_r04-linux_86.tgz The I start the SDK Manager and AVD Manager (UI) according to the README file: ./tools/android And I get the following Installed Packages: - Install SDK Tools, revision 4 Available Packages: - https://dl-ssl.google.com/android/repoisotry/repository.xml - This repository requires a more recent version of the Tools. Please update- - Android SDK Tools, revision 4 - Archive for Linux (comment: funny since rev 4 seems to be what's installed this is what seems to be installed) Now doing an update of the Android SDK Tools, revision 4 or everything results in 99% progress and then the application hangs. Here's the console feedback: johanc@johan-desktop:~/android/android-sdk-linux_86$ tools/android Starting Android SDK and AVD Manager No command line parameters provided, launching UI. See 'android --help' for operations from the command line. Error: null In the app I choose to upgate the following package: Package Description Android SDK Tools, revision 4 Archive Description Archive for Linux Size: 15 MiB SHA1: 99380c9330c1c3728c836206947350cc00fa28c2 Site https://dl-ssl.google.com/android/repository/repository.xml The console output reads (and the app hangs at 99%): Exception in thread "Installing Archives" java.lang.AssertionError at com.android.sdkuilib.internal.tasks.ProgressTask.incProgress(ProgressTask.java:97) at com.android.sdkuilib.internal.repository.UpdaterData$2.run(UpdaterData.java:358) at com.android.sdkuilib.internal.tasks.ProgressTask$1.run(ProgressTask.java:135)

    Read the article

  • Problem with TextViews running into each other in RelativeLayout

    - by Janusz
    I have a problem with two Textviews on the same height in a RelativeLayout running into each other. I use the following Layout. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="centerInside" android:src="@drawable/icon" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="NameNameNameNameNameNameName" android:layout_alignParentTop="true" android:layout_toRightOf="@id/logo" android:gravity="clip_horizontal" android:lines="1" /> <TextView android:id="@+id/information" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="information" android:layout_alignParentRight="true" android:layout_alignParentTop="true" /> <TextView android:id="@+id/nrcoupons" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Number" android:layout_alignRight="@id/information" android:layout_alignBottom="@id/logo" /> <TextView android:id="@+id/subcategory" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Subcategory" android:layout_alignLeft="@id/name" android:layout_alignBottom="@id/logo" /> </RelativeLayout> This gives me this view: Everything is as I need it except the two textviews name and information are displayed on the same screen space with the one on top of the other. How can I avoid this?

    Read the article

  • Is there a difference between starting an application from the OS or from adb

    - by aruwen
    I do have a curious error in my application. My app crashes (don't mind the crash, I roughly know why - classloader) when I start the application from the OS directly, then kill it from the background via any Task Killer (this is one of the few ways to reproduce the crash consistently - simulating the OS freeing memory and closing the application) and try to restart it again. The thing is, if I start the application via adb shell using the following command: adb shell am start -a android.intent.action.MAIN -n com.my.packagename/myLaunchActivity I cannot reproduce the crash. So is there any difference in how Android OS calls the application as opposed to the above call? EDIT: added the manifest (just changed names) <?xml version="1.0" ?> <manifest android:versionCode="5" android:versionName="1.05" package="com.my.sample" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minSdkVersion="7"/> <application android:icon="@drawable/square_my_logo" android:label="@string/app_name"> <activity android:label="@string/app_name" android:name="com.my.InfoActivity" android:screenOrientation="landscape"></activity> <activity android:label="@string/app_name" android:name="com.my2.KickStart" android:screenOrientation="landscape"/> <activity android:label="@string/app_name" android:name="com.my2.Launcher" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/></manifest> starting the com.my2.Launcher from the adb shell

    Read the article

  • Spinner original text

    - by user1696863
    I'm trying my Spinner to display "Select City" before the Spinner has itself been clicked by the user. How can I do this? My current XML code is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.olacabs.customer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/page_background" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/darker_gray" android:gravity="center" android:paddingBottom="4dp" android:paddingTop="4dp" android:text="@string/rate_card" android:textColor="@color/white" android:textSize="20dp" custom:customFont="litera_bold.ttf" /> <Spinner android:id="@+id/select_city" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="40dp" android:prompt="@string/selectCity" /> </LinearLayout> Also, what does android:spinnerMode exactly do. I tried changing its value to dropdown but nothing happened and the application still showed a popup dialogue. My activity that implements this XML file is: public class RateCardActivity extends OlaActivity { public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.rate_card); Spinner spinner = (Spinner) findViewById(R.id.select_city); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.select_city, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); } }

    Read the article

  • Layout: how to make image to change its width and height proportionally?

    - by Exterminator13
    I have such layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_toLeftOf="@+id/my_image" android:ellipsize="end" android:singleLine="true" android:text="Some text" android:textAppearance="?android:attr/textAppearanceMedium" /> <ImageView android:id="@+id/my_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/title" android:layout_alignBottom="@+id/title" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:adjustViewBounds="true" android:src="@drawable/my_bitmap_image" /> This layout does almost what I need: it makes image view height the same as text view. The image graphic contents stretched also keeping aspect ratio. But, the width of the image view does not change! As a result, I have a wide gap between text and the image view! As a temporal solution, I override View#onLayout. The question: how to change image width in xml layout? UPDATE: This is a final layout I need (text + a few images). Look at the first image: its width should be exactly the same as scaled image in it with no paddings and margins:

    Read the article

  • Android SDK fails to install

    - by Paul Breed
    When I try to install the android SDK it fails to install. My OS is Windows XP I just downloaded and installed Java JDK 1.6 Java -version from the command line returns: http://stackoverflow.com/questions/ask java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing) My environment vars have: JAVA_HOME=c:\progra~1\java\jdk1.6.0_11 I downloaded android-sdk-r04-windows.zip I unziped it in V:\AndroidInstall\ When I go to the V:\androindinstall\android-sdk-windows and type "SDK Install.exe" nothing happens... If I go this from graph When I do this from a graphical file viewer I get a quick flash that looks like a command line window and nothing.... When I try to run android list targets from the tool directory I get: Error: Error parsing the sdk. Error: V:\androindinstall\android-sdk-windows\platforms is missing. Error: Unable to parse SDK content. So the basic install setup is not happening. Additional clues: I have a G1 and Android 1.0 was running on this machine. (Almost a year ago) I've updated my G1 to 1.6 so I thought I'd update my SDK before starting new development. When I tried to upgrade it tried and then died as the "directory was in use" So I cleaned out all the android directories, rebooted and redownloaded everythign from scratch. Now it won't run at all. I've clearly got something in an unhappy state, but I've cleaned up all the directories and no remanants seem to be running I've rebooted.... I've missed somethign I just can't figure out what. Paul

    Read the article

  • Android HTTPClient not working inspite of giving permissions in manifest file.

    - by primal
    Hi, I was trying http-cleint tutorials from svn.apache.org. While running the application I am getting the following error in console. [2010-04-30 09:26:36 - HalloAndroid] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.org.example/.HalloAndroid } from null (pid=-1, uid=-1) requires android.permission.INTERNET I have added android.permission.INTERNET in AndroidManifest.xml. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.org.example" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HalloAndroid" android:label="@string/app_name" android:permission="android.permission.INTERNET"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"></uses-permission> </manifest> The java code in HalloAndroid.java is as follows HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget2 = new HttpGet("http://google.com/"); HttpResponse response2 = null; try { response2 = httpclient.execute(httpget2); } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } HttpEntity entity = response2.getEntity(); if (entity != null) { long len = entity.getContentLength(); if (len != -1 && len < 2048) { try { Log.d(TAG, EntityUtils.toString(entity)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { // Stream content out } Any help is much appreciated.

    Read the article

  • Facebook android app keeps crashing even though there are no errors in my code. Why?

    - by user1554479
    If you import the facebook SDK library, the code works (ignore the deprecated methods for now lol) and there are no errors or warnings. However, when I run my facebook app on my Android 2.2 or 4.2 emulator, the app crashes either upon opening or after the log on screen. Why? Is it because I'm not implementing Async Task? If so, how does that work? Here's my code: package com.sara.facebookappl; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.os.StrictMode; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.facebook.android.DialogError; import com.facebook.android.Facebook; import com.facebook.android.Facebook.DialogListener; import com.facebook.android.FacebookError; import com.facebook.android.Util; public class MainActivity extends Activity implements OnClickListener, DialogListener { Facebook fb; ImageView button; SharedPreferences sp; TextView welcome; Button post; @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); post=(Button)findViewById(R.id.button1); String APP_ID = getString(R.string.APP_ID); fb= new Facebook(APP_ID); sp =getPreferences(MODE_PRIVATE); String access_token=sp.getString("access_token", null); long expires=sp.getLong("access_expires", 0); if (access_token !=null) { fb.setAccessToken(access_token); } if(expires !=0) { fb.setAccessExpires(expires); } button=(ImageView)findViewById(R.id.login); button.setOnClickListener((OnClickListener) this); updateButtonImage(); } @SuppressWarnings("deprecation") private void updateButtonImage() { // TODO Auto-generated method stub post.setVisibility(Button.VISIBLE); button.setImageResource(R.drawable.com_facebook_loginbutton_blue); //logout button if (fb.isSessionValid()) { button.setImageResource(R.drawable.com_facebook_loginbutton_blue); // ^logout button JSONObject obj=null; URL img_url =null; try { String jsonUser= fb.request("me"); obj = Util.parseJson(jsonUser); String id=obj.optString("id"); String name = obj.optString("name"); welcome.setText("Welcome, " + name); }catch(FacebookError e) { e.printStackTrace(); }catch (JSONException e) { e.printStackTrace(); }catch (MalformedURLException e) { e.printStackTrace(); }catch (IOException e) { e.printStackTrace(); } }else { post.setVisibility(Button.VISIBLE); button.setImageResource(R.drawable.com_facebook_loginbutton_blue); } } @SuppressWarnings("deprecation") public void buttonClicks(View v) { switch (v.getId()) { case R.id.button1: //post Bundle params= new Bundle(); params.putString("name", "User X"); params.putString("caption", "Rating"); params.putString("description", "User X Rated"); params.putString("link", "http://..."); fb.dialog(MainActivity.this, "feed", params, new Facebook.DialogListener() { @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } }); break; } } @SuppressWarnings("deprecation") public void onClick(View v) { if(fb.isSessionValid()) { try { fb.logout(getApplicationContext()); updateButtonImage(); //button will close our our session }catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } }else{ //login into facebook fb.authorize(MainActivity.this, new String[] {"email"}, new Facebook.DialogListener() { @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "fbError", Toast.LENGTH_SHORT).show(); } @Override public void onError(DialogError e) { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "onError", Toast.LENGTH_SHORT).show(); } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub Editor editor=sp.edit(); editor.putString("access_token", fb.getAccessToken()); editor.putLong("access_expires", fb.getAccessExpires()); editor.commit(); updateButtonImage(); } @Override public void onCancel() { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "onCancel", Toast.LENGTH_SHORT).show(); } }); } } @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; } @SuppressWarnings("deprecation") @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); fb.authorizeCallback(requestCode, resultCode, data); } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } } LogCat Errors: 12-16 04:56:59.070: E/AndroidRuntime(822): FATAL EXCEPTION: main 12-16 04:56:59.070: E/AndroidRuntime(822): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sara.facebookappl/com.sara.facebookappl.MainActivity}: android.os.NetworkOnMainThreadException 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.Handler.dispatchMessage(Handler.java:99) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.Looper.loop(Looper.java:137) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.main(ActivityThread.java:5039) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.lang.reflect.Method.invokeNative(Native Method) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.lang.reflect.Method.invoke(Method.java:511) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-16 04:56:59.070: E/AndroidRuntime(822): at dalvik.system.NativeStart.main(Native Method) 12-16 04:56:59.070: E/AndroidRuntime(822): Caused by: android.os.NetworkOnMainThreadException 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.getAllByName(InetAddress.java:214) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.(HttpConnection.java:70) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.(HttpConnection.java:50) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:461) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:282) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Util.openUrl(Util.java:219) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Facebook.requestImpl(Facebook.java:806) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Facebook.request(Facebook.java:732) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.sara.facebookappl.MainActivity.updateButtonImage(MainActivity.java:83) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.sara.facebookappl.MainActivity.onCreate(MainActivity.java:63) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.Activity.performCreate(Activity.java:5104) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 12-16 04:56:59.070: E/AndroidRuntime(822): ... 11 more 12-16 04:56:59.090: D/dalvikvm(822): GC_CONCURRENT freed 150K, 9% free 2723K/2988K, paused 7ms+58ms, total 239ms

    Read the article

  • GridView row remove and animation - Android

    - by Pria
    I have a GridView in which each row has a custom view. The grid view adapter has an array that keeps the custom view. At click of a button, I want to remove a specific row from the Grid and while doing so I want animation on it. I have an AnimationListener. When I remove the upper most row from the array and setAdapter in onAnimationEnd(). It works perfectly fine. But, when I remove any other row, it gives a NullPointerException in the main thread. The exception thread is as follows: ERROR/AndroidRuntime(11503): java.lang.NullPointerException at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1227) at android.widget.AbsListView.dispatchDraw(AbsListView.java:1319) at android.view.View.draw(View.java:5944) at android.widget.AbsListView.draw(AbsListView.java:2121) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1847) at android.view.ViewRoot.draw(ViewRoot.java:1217) at android.view.ViewRoot.performTraversals(ViewRoot.java:1030) at android.view.ViewRoot.handleMessage(ViewRoot.java:1482) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3948) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) at dalvik.system.NativeStart.main(Native Method) Please help!!!

    Read the article

  • android: start an intent into a framelayout

    - by user329692
    Hi guys! I have a main activity with this layout file: <?xml version="1.0" encoding="utf-8"?> <Button android:id="@+id/btn_reload" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Reload" /> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical|center_horizontal" > <ImageView android:id="@+id/ImageView01" android:src="@drawable/logo_head" android:scaleType="fitStart" android:adjustViewBounds="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> <FrameLayout android:id="@+id/center" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"> </FrameLayout> <LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center" android:id="@+id/footer" android:layout_weight="2.6" android:background="#ffffff"> </LinearLayout> Basically it is composed by an header, a central part (android:id="@+id/center") and a footer. The footer contains four buttons, created dinamically. At the end it looks like a TabWidget with the tabs at the botton. Each footer's buttons holds an Intent/activity. The question is: How can i start my activity into the FrameLayout? For instance TabHost does this: ..... spec = tabHost .newTabSpec(tabTitle.toLowerCase()) .setIndicator(tabTitle,res.getDrawable(R.drawable.tab_spec)) .setContent(intent); tabHost.addTab(spec); ....

    Read the article

  • Android crashes when calling ImageButton

    - by Joël
    I have a crash (Application Stopped Unexpectedly) problem with this main.xml is a "HelloWorld" type project (while testing and learning features I need for my app) : I isolated the ImageButton as an issue, but I can't isolate any of the parameters... <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageButton android:id="@+id/picture" android:layout_width="240dip" android:layout_height="180dip" android:layout_gravity="center_horizontal" android:src="@drawable/icon" android:adjustViewBounds="true" android:cropToPadding="true" android:clickable="true" android:scaleType="fitCenter" /> </LinearLayout> icon.png exists in my resources... I can see the preview in the Layout tab, even though the image is not centered on the button, but I read that it was normal. The code below works fine (as a regular Button). I can also do the same as an ImageView. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/picture" android:layout_width="240dip" android:layout_height="180dip" android:layout_gravity="center_horizontal" /> </LinearLayout> I use Eclipse and the AVD, and all my learning is done on 2.1 (SDK level 7). I can't test the app on an actual device yet as I don't have it yet. Thanks in advance !

    Read the article

  • Problem with sizes of EditText and Button in Android

    - by DixieFlatline
    I want to make the edittext width the same size as button. My EditText is currently very small. I use relative layout. <TextView android:id="@+id/aha4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="17dip" android:text="Vzdevek:" android:layout_below="@id/aha3" /> <EditText android:id="@+id/nick" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@id/nivo" android:layout_toRightOf="@id/aha4"/> <Button android:id="@+id/poslji" android:text="Pošlji" android:layout_height="wrap_content" android:layout_width="20dip" android:typeface="serif" android:textStyle="bold" android:layout_alignParentRight="true" android:layout_below="@id/nivo" android:layout_toRightOf="@id/nick"/> What i currently get is this: What is the appropriate layout_width for edittext and button?

    Read the article

  • Replicate behavior of Android browser

    - by Brian515
    Hi all, I am writing for Android, and I can't figure out how to replicate the effect of the Android browser where the progress bar is at the top of the screen, with the webview below it, yet when you scroll down, the bar scrolls with the page. I've tried placing both the webview and the progress bar into a scrollview, but when I do that, the webview becomes completely unresponsive and will not load (or respond to any commands, for that matter). Any help would be greatly appreciated. Thanks! P.S., I'm using the Eclipse IDE, and I'd like to to continue using the 1.5 SDK if possible to maintain backwards compatibility (and just to be able use my own application -- my phone isn't getting 2.1 for a couple of months).

    Read the article

  • Bug in the official Android Fragments training sample?

    - by Jeff Axelrod
    It seems to me that there must be a bug in the Android Fragments demo. As background, Fragments are apparently sometimes instantiated by the Android OS and thus need a public no-arg constructor: All subclasses of Fragment must include a public empty constructor. The framework will often re-instantiate a fragment class when needed, in particular during state restore, and needs to be able to find this constructor to instantiate it. If the empty constructor is not available, a runtime exception will occur in some cases during state restore. But the NewsReader demo from the official Android training on Fragments constructs the HeadlinesFragment class and configures it with setOnHeadlineSelectedListener(this) from NewsReaderActivity.onCreate(). If the Android OS re-instantiates this fragment, the mHeadlineSelectedListener field will be null because HeadlinesFragment doesn't save or restore its state. Is this a bug or am I missing something?

    Read the article

  • Android simple question

    - by Josemalive
    Hi, I have an android application that shows a grid view that shows: 1 2 3 4 GridView gridview=(GridView)findViewById(R.id.GridView_test); DataBaseHelper dbhelper=new DataBaseHelper(this); ArrayList<String> test=new ArrayList<String>(5); backlinksadapter.add("1"); backlinksadapter.add("2"); backlinksadapter.add("3"); backlinksadapter.add("4"); ArrayAdapter mAdapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test); gridview.setAdapter(mAdapter); By the moment is working, but i would like to show foreach line of the grid, 2 columns with the values of a 2 dimensional array (something like the GridView in ASP.Net - as datasource -). I would like to show: 1 | Person 1 2 | Person 2 3 | Person 3 4 | Person 4 Any idea? Thanks in advance. Jose.

    Read the article

  • Android listview array adapter selected

    - by João Melo
    i'm trying to add a contextual action mode to a listview, but i'm having some problems with the selection, if i make aList1.setSelection(position) it doesn't select anything, and if i make List1.setItemChecked(position, true) it works but it only changes the font color a little and i want it to change the background or something more notable, is there any way to detect the selection and manually and change the background, or i'm missing something? the list: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/list1" android:layout_width="match_parent" android:layout_height="match_parent" android:choiceMode="singleChoice" android:drawSelectorOnTop="false"> </ListView> </RelativeLayout> the adapter: public class ServicesRowAdapter extends ArrayAdapter<String[]> { private final Activity context; private final ArrayList<String[]> names; static class ViewHolder { public TextView Id; public TextView Date; public RelativeLayout statusbar,bglayout; } public ServicesRowAdapter(Activity context, ArrayList<String[]> names) { super(context, R.layout.servicesrowlayout, names); this.context = context; this.names = names; } @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.servicesrowlayout, null); ViewHolder viewHolder = new ViewHolder(); viewHolder.Id = (TextView) rowView.findViewById(R.id.idlabel); viewHolder.Date = (TextView) rowView.findViewById(R.id.datelabel); rowView.setTag(viewHolder); } ViewHolder holder = (ViewHolder) rowView.getTag(); holder.Date.setText(names.get(position)[2]); holder.Id.setText(names.get(position)[1]); return rowView; } } with the use of a layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/idlabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:gravity="right" android:text="@+id/idlabel" android:textSize="20dp" android:width="70dp" > </TextView> <TextView android:id="@+id/datelabel" android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/datelabel" android:textSize="20dp" android:layout_marginLeft="90dp" > </TextView> </RelativeLayout

    Read the article

  • Better way to get int from FragmentActivity in a Fragment?

    - by Gimberg
    Hi im trying to get an int from my FragmentActivity and i have a way to do this but the code get very cluttered and long and i did this to shorten the problem and i don't get any errors while in the editor but when i run the app it eminently crashes. Any suggestions? An example of the code that doesn't work MainActivity mainActivity = ((MainActivity)getActivity()); public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.upgrades_fragment, container, false); TextView AirFreshenersCost = (TextView) view.findViewById(R.id.AirFreshenersCost ); if(mainActivity.amountAirFresheners == 5){ AirFreshenersCost.setText("5"); } return view; } LogCat 10-27 22:16:37.333: E/AndroidRuntime(5593): FATAL EXCEPTION: main 10-27 22:16:37.333: E/AndroidRuntime(5593): java.lang.NullPointerException 10-27 22:16:37.333: E/AndroidRuntime(5593): at com.free.dennisg.clickingbad.fragments.UpgradesFragment.onCreateView(UpgradesFragment.java:40) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:472) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.view.ViewPager.populate(ViewPager.java:1068) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.view.ViewPager.populate(ViewPager.java:914) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.support.v4.view.ViewPager$3.run(ViewPager.java:244) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.view.Choreographer.doCallbacks(Choreographer.java:562) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.view.Choreographer.doFrame(Choreographer.java:531) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.os.Handler.handleCallback(Handler.java:730) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.os.Handler.dispatchMessage(Handler.java:92) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.os.Looper.loop(Looper.java:137) 10-27 22:16:37.333: E/AndroidRuntime(5593): at android.app.ActivityThread.main(ActivityThread.java:5289) 10-27 22:16:37.333: E/AndroidRuntime(5593): at java.lang.reflect.Method.invokeNative(Native Method) 10-27 22:16:37.333: E/AndroidRuntime(5593): at java.lang.reflect.Method.invoke(Method.java:525) 10-27 22:16:37.333: E/AndroidRuntime(5593): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 10-27 22:16:37.333: E/AndroidRuntime(5593): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 10-27 22:16:37.333: E/AndroidRuntime(5593): at dalvik.system.NativeStart.main(Native Method) An example of the code that work public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.upgrades_fragment, container, false); TextView AirFreshenersCost = (TextView) view.findViewById(R.id.AirFreshenersCost ); if(((MainActivity)getActivity()).amountAirFresheners == 5){ AirFreshenersCost.setText("5"); } return view; }

    Read the article

  • Android refresh StateListDrawable problem

    - by Max
    Hi all, I have a strange problem with StateListDrawable or maybe (probably) I'm missing something. I created a test application for it and the same problem occurs. So, this is my StateListDrawable resourse in file test_selection.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true"> <shape android:shape="rectangle" android:background="#ff0000"> <corners android:radius="10dp" /> <gradient android:startColor="#ff5555" android:endColor="#ff5555" android:angle="0" /> </shape> </item> <item android:state_selected="false"> <shape android:shape="rectangle" android:background="#eeeeee"> <corners android:radius="10dp" /> <gradient android:startColor="#eeeeee" android:endColor="#eeeeee" android:angle="0" /> </shape> </item> </selector> It's a very simple selector that draw a red color for selected state and a white rect for the unselected one. My main.xml template is very simple. I simply use a TextView that uses the selection as background. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:textSize="30dp" android:id="@+id/test_view_example" android:background="@drawable/test_selection"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/refresh" android:onClick="updateView" android:text="refresh"></Button> </LinearLayout> My Activity code is also very simple. public class TestDrawableStateActivity extends Activity { private final static int[] SELECTED_STATE = { android.R.attr.state_selected }; private final static int[] UNSELECTED_STATE = {}; private TextView textView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textView = (TextView) findViewById(R.id.test_view_example); } @Override protected void onResume() { super.onResume(); // Carichiamo la Drawable if(textView.getBackground().setState(SELECTED_STATE)){ textView.invalidate(); } } public void updateView(View view) { if(textView.getBackground().setState(SELECTED_STATE)){ textView.invalidate(); }; } } When Activity starts I try to set the state of my Drawable (the StateListDrawable) with the value SELECTED. It seems all very simple.... but the problem is that the state is not shown. If, later, I click a button and execute the method updateView() the state changes. Where is my problem? Where am I wrong? Thankx a lot Max

    Read the article

  • How to Use border as an image in android xml

    - by Ethan Hunt
    I have a popup to show in my xml. It should have a border. Following is the code:- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="20dp" > <RelativeLayout android:id="@+id/rl_startpopup" android:layout_width="340dp" android:layout_height="320dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="@drawable/popup_outline" android:orientation="vertical" /> </RelativeLayout> The popup_outline is a shape <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="270" android:endColor="#192423" android:startColor="#4a7669" android:type="linear" /> <corners android:radius="8dp" /> <stroke android:width="2dp" android:color="#e4f4d3" /> </shape> here is the image of the popup:- This "popup_outline" is the white border shown. I want to use a repeatable pattern image instead of one color as the border. I have to do this in xml. Please help

    Read the article

  • LinearLayout as custom button, OnClickListener never called

    - by ohra
    I've been using the common Android Button with both icon (drawableTop) and text. It works really poorly if you want to have a non-standard size button, so I decided to make a custom button with a LinearLayout having the following layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/ButtonHoloDark" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:clickable="true" android:focusable="true" android:orientation="vertical" > <ImageView android:id="@+id/buttonIcon" android:layout_width="fill_parent" android:layout_height="wrap_content" android:duplicateParentState="true" /> <TextView android:id="@+id/buttonText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:duplicateParentState="true" android:gravity="center" android:textColor="@color/white" /> </LinearLayout> The layout is used by a custom class: public class CustomIconButton extends LinearLayout { public CustomIconButton(Context context, AttributeSet attrs) { super(context, attrs); setAttributes(context, attrs); LayoutInflater.from(context).inflate(R.layout.custom_icon_button, this, true); } ... But when I set an OnClickListener on my button in its parent layout it never gets called. I can only receive clicks if a set the listener to the ImageView and/or TextView. This leads to two possible effects when the button is clicked: The click is inside the ImageView or the TextView. The click is registered ok, but the buttons state drawable doesn't change i.e. it doesn't appear depressed. The click is inside the "empty area" of the button. The click is not registered, but the state drawable works ok. Neither of these is feasible. I've played around with the following attributes on the LinearLayout or its children, but none really seem to have any effect whether true or false: duplicateParentState clickable focusable There doesn't seem to be any reasonable way to get the LinearLayout parent receive clicks instead of its children. I've seen some possible solutions overriding dispatchTouchEvent or onInterceptTouchEvent on the custom component itself, but that really seems like a big mess if I have to start analyzing touch events to identify proper clicks. So OnClickListener on a LinearLayout with children = no go?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >