Search Results

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

Page 40/703 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Android, how to use DexClassLoader to dynamically replace an Activity or Service

    - by RickNotFred
    I am trying to do something similar to this stackoverflow posting. What I want to do is to read the definition of an activity or service from the SD card. To avoid manifest permission issues, I create a shell version of this activity in the .apk, but try to replace it with an activity of the same name residing on the SD card at run time. Unfortunately, I am able to load the activity class definition from the SD card using DexClassLoader, but the original class definition is the one that is executed. Is there a way to specify that the new class definition replaces the old one, or any suggestions on avoiding the manifest permission issues without actually providing the needed activity in the package? The code sample: ClassLoader cl = new DexClassLoader("/sdcard/mypath/My.apk", getFilesDir().getAbsolutePath(), null, MainActivity.class.getClassLoader()); try { Class<?> c = cl.loadClass("com.android.my.path.to.a.loaded.activity"); Intent i = new Intent(getBaseContext(), c); startActivity(i); } catch (Exception e) { Intead of launching the com.android.my.path.to.a.loaded.activity specified in /sdcard/mypath/My.apk, it launches the activity statically loaded into the project.

    Read the article

  • Android: Learning the platform, have any app suggestions?

    - by David
    I'm beginning to learn mobile programming on the Android platform. I'm up for working with any particular base SDK. I just want to hear some suggestions from the community about what types of applications I should start with to help learn more advanced interactions with the platform. There are of course the Standard Hello World, calculator, etc. But by now I am bored with all of those. What do you all make when learning a new language?

    Read the article

  • Android Emulator not loading on netbeans

    - by Drahcir
    I just downloaded the android sdk from the adnroid site and followed this tutorial to set it up on netbeans. Everything to seem to have installed fine but whenever i try to run the application this window pops up: What I am assuming it asking me to choose the emulator, but it is not showing up on the list. Is there a reason why?

    Read the article

  • Using ListViews on Android?

    - by Robert
    I am just getting started with the Android SDK and I had a quick question. I am trying to set up a ListView with a rectangle of color on the left and then a bit of text for each row. I also want to make it so I can click each entry in the list and open a new activity to display some information (similar to the contact list). Anyone have any examples to help me out?

    Read the article

  • Missing styles. Is the correct theme chosen for this layout?

    - by user1820007
    Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'mapViewStyle' in current theme. I tried every solutions available to solve this problem. But nothing seems to work. I have included library in the manifest file. I even created style is styles.xml. I have chosen Google Apis build target as well. Can somebody please give me a solution. Thank you in advance for your valuable time... here is my xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" style="@style/AppTheme" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.google.android.maps.MapView android:id="@+id/themap" style="@style/mapViewStyle" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="here i have my key" android:clickable="true" android:enabled="true" /> </RelativeLayout> ` Here is my manifest snippet: <uses-library android:name="com.google.android.maps" /> <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Second" /> <acttiviy android:name=".Third" android:theme="@android:style/Theme.Black" /> </application> here is my style.xml file <style name="mapViewStyle" parent="@android:style/Theme.Black"> </style> </resources>

    Read the article

  • ListView item background via custom selector

    - by Gil
    Is it possible to apply a custom background to each Listview item via the list selector? The default selector specifies @android:color/transparent for the state_focused="false" case, but changing this to some custom drawable doesn't affect items that aren't selected. Romain Guy seems to suggest in this answer that this is possible. I'm currently achieving the same affect by using a custom background on each view and hiding it when the item is selected/focused/whatever so the selector is shown, but it'd be more elegant to have this all defined in one place. For reference, this is the selector I'm using to try and get this working: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="false" android:drawable="@drawable/list_item_gradient" /> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_background_disabled" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" /> </selector> And this is how I'm setting the selector: <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:listSelector="@drawable/list_selector_background" /> Thanks in advance for any help!

    Read the article

  • Multi lined Multi styled button

    - by user1321811
    Hi i'm trying to recreate this button style more specifically the 'view basket' button. waitrose app The button needs to have multiple lines of text each with a different text size and font colour etc. Here's the code so far. I've created the button and its displays correctly but when you click on it the state pressed isn't working. Where am I going wrong. Thanks in advance. xml button file: <?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" android:orientation="vertical" android:state_pressed="true" android:state_focused="true" android:background="@drawable/button_bg" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some Text" android:state_pressed="false" android:state_focused="false" android:textColor="#ffffff" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some Text" android:state_pressed="false" android:state_focused="false" android:textColor="#ffffff" /> </LinearLayout> java file code: package com.buttons2; import com.buttons2.R; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class Buttons2Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.button1); setContentView(R.layout.button); } }

    Read the article

  • Can I add a portrait layout on top of a landscape Camera SurfaceView?

    - by Uwe Krass
    My application should hold a camera preview surface. The camera is fixed to landscape view via AndroidMainfest.xml <application android:icon="@drawable/icon" android:label="Camera"> <uses-library android:name="com.google.android.maps" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <activity android:name=".CameraPreview" android:label="Camera" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> If there is another way to get the camera preview itself to behave correctly, please let me know. Now I need to have an overlay that holds a bunch of buttons. Due to usability, the user interface should be set to portrait view (or even better orientation aware). Is there a way to have a transparent layout (for buttons and other GUI elements) in portrait orientation? I tried to write a special rotated layout by extending a RelativeLayout, but the onDraw method isn't called at anytime. public class RotatedOverlay extends RelativeLayout { private static final String TAG = "RotatedOverlay"; public RotatedOverlay(Context context, AttributeSet attrs ) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { canvas.rotate(90); super.onDraw(canvas); } I am quite new to the Android plattform programming. Of course I dont know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks (even studied the native Camera implementation), but couldnt find a good solution so far. Maybe it works with two seperate Activities, but I dont think, that this can the right solution.

    Read the article

  • asses resouces from another apk for widget(like theme apk)

    - by Diljeet
    asses resouces from another apk for widget(like theme apk) Hello i made a theme with drawables and strings, i can access the theme's resources by following commands String packagename="com....."; Resources res = context.getPackageManager().getResourcesForApplication(packagename); int strid = res.getIdentifier(packagename+":string/"+name, "string", packagename); int drawableid = res.getIdentifier(packagename+":drawable/"+name, "drawable", packagename); String name = res.getString(resid); Bitmap bmp = BitmapFactory.decodeResource(res, resid); //or Drawable dr=res.getDrawable(resid); I can get the drawables, but i don't know how to set the drawables in xml to a widget. I only can set setImageViewResource(int viewid, int resId); So i am asking that how to access xml resources from another apk and set widget drawables from it. I want to access a resource like this from another theme apk, but i can only access the drawable(so can't use it for widgets) <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/wplayh" /> <item android:drawable="@drawable/wplay" /> </selector>

    Read the article

  • AvoidXferMode Tolerance

    - by kayahr
    I have a problem with the following code: protected void onDraw(Canvas canvas) { Paint paint = new Paint(); // Draw a blue circle paint.setColor(Color.BLUE); canvas.drawCircle(100, 100, 50, paint); // Draw a red circle where it collides with the blue one paint.setXfermode(new AvoidXfermode(Color.BLUE, 0, Mode.TARGET)); paint.setColor(Color.RED); canvas.drawCircle(50, 50, 50, paint); } According to the API documentation of AvoidXfermode the tolerance value 0 means that it looks for an EXACT color match. This should work here because I specify the same color as I used for drawing the first circle. But the result is that the red circle is not drawn at all. When I use a tolerance value of 255 instead then it works (red circle is drawn where it collides with the blue one) but that sounds wrong because with such a high tolerance I think it should draw the circle EVERYWHERE. So what's wrong here? API Documentation? Android? Me?

    Read the article

  • Again ImageButton issues

    - by pedr0
    Thanks at all for all your help for now.I have another little issues This is a portion of my layout which give me some problems: <RelativeLayout android:id="@+id/card_address_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="visible" > <TextView style="@style/card_field" android:id="@+id/card_indirizzo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="left|center_vertical" android:layout_marginTop="8dp" android:maxLength="35" android:ellipsize="marquee" /> <ImageButton android:id="@+id/card_address_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" android:layout_toRightOf="@id/card_indirizzo" android:src="@drawable/map_selector" android:onClick="startMap" android:padding="0dp" /> </RelativeLayout> The image button src is a selector, in this case this one: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/map_b" /> <!-- pressed --> <item android:drawable="@drawable/map_a" /> <!-- default --> This is the result and I really don't understand why, why the image button has padding??!!! Help meeeee!

    Read the article

  • Get the screen height in Android

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

    Read the article

  • How to parse the AndroidManifest.xml file inside an .apk package

    - by jnorris
    This file appears to be in a binary XML format. What is this format and how can it be parsed programmatically (as opposed to using the aapt dump tool in the SDK)? This binary format is not discussed in the in the documentation here: http://developer.android.com/guide/topics/manifest/manifest-intro.html Note: I want to access this information from outside the Android environment, preferably from Java.

    Read the article

  • Android Eclipse Error "Android Packaging Problem"

    - by Peter Delaney
    Hello; I am getting an error in my Problems tab for my Android Project in Eclipse. The error is "Android Packaging Problem" with an Unknown location. Unknown Error NullPointerException I cannot determine what this problem is. My project was working a few hours ago. The only change I made was to add a public interface ITrackDao to my project and implement it. There are no errors associated with this. I am not even sure where to begin to look. I cannot launch the application. Can someone give me an idea on what area I can look into? Thanks Peter

    Read the article

  • Android Permission Issue android.permission.READ_CONTACTS

    - by jkmcgee
    Hello, All I am trying to do is read a contact off of my emulator and display it to the screen. I can't seem to resolve this error. Both of my packages (com.msi.ibm.tutorial and .MobileServiceCallContacts) have the permission READ_CONTACTS set in their manifest xml files. So any ideas as to what I've got wrong ? Here is the error message from eclipse console if it helps, it's not helping me, but I'm a little rusty at this and completely new to Android development. MobileServiceCallContacts]Starting activity com.msi.ibm.tutorial.MobileServiceCallContacts on device MobileServiceCallContacts]ActivityManager: Starting: Intent { cmp=com.msi.ibm.tutorial/.MobileServiceCallContacts } MobileServiceCallContacts]ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.msi.ibm.tutorial/.MobileServiceCallContacts } from null (pid=-1, uid=-1) requires android.permission.READ_CONTACTS

    Read the article

  • Problems installing iPhone final 3.2 SDK on OSX

    - by user34475
    I downloaded the latest iPhone SDK (xcode_3.2.2.2_and_iPhone_SDK_3.2_final.dmg) from Apple and uninstalled the old SDK before the install. I double-clicked the .dmg file and got the following pop-ups: The following Disk Images couldn't be found and xcode_3.2.2.2_and_iPhone_SDK_3.2_final.dmg is not recognized I am using OS 10.6.3 How do I solve this?

    Read the article

  • route finding between two designation on maps in android?

    - by androidbase Praveen
    i want to just find a shortest path between the location on map. we have to pass the location's geopoint then click the button to get direction. it will show the shortest path like a blue line. how to do this? i search about this. many of them import a package com.google.googlenav.*;. where i have to get this? Any Idea???? Edit:got downloaded the Cloudemade API. how to draw the lines between the points.

    Read the article

  • Display pdf within app on android?

    - by alex
    I got very frustrated when I realized that android is not able to display pdfs (in a webview or whatever) out-of-the-box. So my question, are there any (os) jars or classes to display a pdf document within an app? Thx in advance, alex

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >