Search Results

Search found 708 results on 29 pages for 'drawable'.

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

  • How to set a imageButton is an RSS

    - by L?c Song
    I have a feed_layout.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:baselineAligned="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal" > <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:onClick="homeImageButton" android:scaleType="fitStart" android:src="@drawable/home" android:tag="1" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:scaleType="centerCrop" android:onClick="thegioiImageButton" android:src="@drawable/home" android:tag="2" /> </LinearLayout> </LinearLayout> <LinearLayout android:baselineAligned="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal" > <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:scaleType="centerCrop" android:onClick="giaitriImageButton" android:src="@drawable/home" android:tag="3" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:scaleType="centerCrop" android:onClick="thethaoImageButton" android:src="@drawable/home" android:tag="4" /> </LinearLayout> </LinearLayout> <LinearLayout android:baselineAligned="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal" > <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:scaleType="centerCrop" android:onClick="khoahocImageButton" android:src="@drawable/home" android:tag="5" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <ImageButton android:layout_width="138dp" android:layout_height="138dp" android:layout_gravity="center" android:scaleType="centerCrop" android:onClick="xeImageButton" android:src="@drawable/home" android:tag="6" /> </LinearLayout> </LinearLayout> </LinearLayout> and feedActivity.java package com.dqh.vnexpressrssreader; import android.R.string; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageButton; import android.widget.Toast; public class FeedActivity extends Activity { public String tagImg; private static final String TAG = "FeedActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.feed_layout); } public void homeImageButton(View v) { ImageButton imageButtonClicked = (ImageButton)v; tagImg = imageButtonClicked.getTag().toString(); setTagImg(tagImg); String tt = getTagImg(); Log.d(TAG, "FeedId: " + tt); Intent intent = new Intent(getApplicationContext(), ItemsActivity.class); startActivityForResult(intent, 0); } public void thegioiImageButton(View v) { ImageButton imageButtonClicked = (ImageButton)v; tagImg = imageButtonClicked.getTag().toString(); //Log.d(TAG, "FeedId: " + imageButtonClicked.getTag()); Log.d(TAG, "FeedId: " + tagImg); Intent intent = new Intent(getApplicationContext(), ItemsActivity.class); startActivityForResult(intent, 0); } } and RssReader.java /** * */ package com.dqh.vnexpressrssreader.reader; import java.util.ArrayList; import java.util.List; import org.json.JSONException; import org.json.JSONObject; import com.dqh.vnexpressrssreader.FeedActivity; import com.dqh.vnexpressrssreader.NewsRssReaderDB; import com.dqh.vnexpressrssreader.util.RSSHandler; import com.dqh.vnexpressrssreader.util.Tintuc; import android.content.Context; import android.text.Html; import android.util.Log; /** * @author rob * */ public class RssReader { private final static String TAG = "RssReader"; private final static String BOLD_OPEN = "<B>"; private final static String BOLD_CLOSE = "</B>"; private final static String BREAK = "<BR>"; private final static String ITALIC_OPEN = "<I>"; private final static String ITALIC_CLOSE = "</I>"; private final static String SMALL_OPEN = "<SMALL>"; private final static String SMALL_CLOSE = "</SMALL>"; /** * This method defines a feed URL and then calles our SAX Handler to read the tintuc list * from the stream * * @return List<JSONObject> - suitable for the List View activity */ public static List<JSONObject> getLatestRssFeed(Context context) { NewsRssReaderDB newsRssReaderDB = new NewsRssReaderDB(context); List<Tintuc> tintucsFromDB = newsRssReaderDB.getLists(); return fillData(tintucsFromDB); } public static void getLatestRssFeed(Context context, String feed) { NewsRssReaderDB newsRssReaderDB = new NewsRssReaderDB(context); feed = "http://vnexpress.net/rss/the-gioi.rss"; //RSS 2 feed = "http://vnexpress.net/rss/the-thao.rss"; //RSS 3 feed = "http://vnexpress.net/rss/home.rss"; RSSHandler rh = new RSSHandler(); List<Tintuc> tintucs = rh.getLatestTintucs(feed); if ((tintucs != null) && (tintucs.size() > 0)) { for (Tintuc tintuc : tintucs) { if ((tintuc.getUrl() != null) && !newsRssReaderDB.checkUrlExist(tintuc.getUrl().toString())) { long tintucId = newsRssReaderDB.insertTintuc(tintuc); if (tintucId > 0) { Log.d(TAG, "saved tintucId: " + tintucId); } else { Log.e(TAG, "saved tintucId fail"); } } else { Log.e(TAG, "tintucs exist!"); } } } } /** * This method takes a list of Tintuc objects and converts them in to the * correct JSON format so the info can be processed by our list view * * @param tintucs - list<Tintuc> * @return List<JSONObject> - suitable for the List View activity */ private static List<JSONObject> fillData(List<Tintuc> tintucs) { List<JSONObject> items = new ArrayList<JSONObject>(); for (Tintuc tintuc : tintucs) { JSONObject current = new JSONObject(); try { buildJsonObject(tintuc, current); } catch (JSONException e) { Log.e("RSS ERROR", "Error creating JSON Object from RSS feed"); } items.add(current); } return items; } /** * This method takes a single Tintuc Object and converts it in to a single JSON object * including some additional HTML formating so they can be displayed nicely * * @param tintuc * @param current * @throws JSONException */ private static void buildJsonObject(Tintuc tintuc, JSONObject current) throws JSONException { String title = tintuc.getTieude(); String description = tintuc.getMota(); ///////////////////////// //////// 2 ///////////// String date = tintuc.getPubDate(); String imgLink = tintuc.getImgLink(); StringBuffer sb = new StringBuffer(); sb.append(BOLD_OPEN).append(title).append(BOLD_CLOSE); sb.append(BREAK); sb.append(description); sb.append(BREAK); sb.append(SMALL_OPEN).append(ITALIC_OPEN).append(date).append(ITALIC_CLOSE).append(SMALL_CLOSE); current.put("text", Html.fromHtml(sb.toString())); current.put("imageLink", imgLink); current.put("url", tintuc.getUrl().toString()); current.put("title", tintuc.getTieude()); } } I have 1 array RSS and I want each ImageButton is assigned a Rss??. I have attempt to call to FeedActivity from RSSReader but not be help me !

    Read the article

  • Large margin by long title

    - by Kevin Koenen
    I try to show a list of offers. When an advertiser insert a large title, the margin of an item (offer) will be showed what shouldn't. I've tried different layouts but that doesn't work. Link to image :) You see, some of the items has a large margin. Here's the code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallerylayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:gravity="left|center" android:layout_width="wrap_content" android:paddingBottom="2dp" android:paddingTop="2dp" android:paddingLeft="5dp" android:background="#20000000" android:cacheColorHint="#00000000"> <ImageView android:id="@+id/ad_image_small" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6dip" android:src="@drawable/ic_launcher"/> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <TextView android:id="@+id/ad_id" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/ad_img_url" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/ad_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dp" android:gravity="left" android:textColor="#000000" android:ellipsize="end" android:singleLine="true"/> <TextView android:id="@+id/ad_km" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="3dp" android:layout_marginBottom="1dp" android:textColor="#000000" android:gravity="right"/> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/ad_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:textColor="#0099CC" android:ellipsize="end" android:singleLine="true"/> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2dp" android:padding="5dp"> <ImageView android:id="@+id/ad_clock" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginRight="5dip" android:src="@drawable/icon_clock"/> <ProgressBar android:id="@+id/progressbar" android:layout_width="match_parent" android:layout_height="8dp" android:layout_margin="5dp" android:paddingLeft="2dp" android:max="100" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/color_progressbar" /> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:id="@+id/overlay_image" android:background="#0000" android:src="@drawable/verlopen2x" android:layout_alignTop="@id/ad_image_small" android:layout_alignBottom="@id/ad_image_small" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:visibility="visible" /> I can't see what i'm doing wrong. Thanks in advance!

    Read the article

  • ListActivity problem when using with RelativeLayout

    - by tomgamer
    Newb alert, I'm sure I'm doing something dumb here. I've been progressively expanding my UI, and I want to add a ListView in the middle of my UI. When I add it and change the activity to extend a ListActivity instead of just an Activity, I'm getting a Force Close. Using 1.5. Does a ListView not work embedded in a RelativeLayout? Thanks public class Categories extends ListActivity{ final static String[] ITEMS = {"blah", "floop", "gnarlp", "stuff"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.categories); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.listrow, R.id.textview, ITEMS); setListAdapter(adapter); XML looks like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView android:id="@+id/ImageView01" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="center" android:background="@drawable/background"> </ImageView> <ImageView android:id="@+id/ImageView02" android:src="@drawable/cat_heading" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerHorizontal="true"> </ImageView> <ListView android:id="@+id/ListView01" android:layout_below="@id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content"></ListView> <RelativeLayout android:id="@+id/RelativeLayout02" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignBottom="@+id/RelativeLayout01" android:layout_centerHorizontal="true"> <ImageButton android:id="@+id/ImageButtonRecipes" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:src="@drawable/recipes"></ImageButton> <ImageButton android:id="@+id/ImageButtonSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_toRightOf="@+id/ImageButtonRecipes" android:src="@drawable/search"></ImageButton> </RelativeLayout> </RelativeLayout> and the listrow.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview"/> </LinearLayout>

    Read the article

  • How can i do the same thing with Gallery in Android

    - by Maxood
    I am navigating images with the clicks of next and previous buttons.Here is my code: package com.myapps.imagegallery; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class ImageGallery extends Activity { /** Called when the activity is first created. */ int imgs[] = {R.drawable.bluehills,R.drawable.lilies,R.drawable.sunset,R.drawable.winter}; String desc[] = {"Blue Hills", "Lillies", "Sunset", "Winter" }; int counter=0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ImageView imgView = (ImageView)findViewById(R.id.ImageView01); imgView.setImageResource(imgs[counter]); final TextView tvDesc = (TextView)findViewById(R.id.tvDesc); Button btnNext = (Button)findViewById(R.id.btnNext); btnNext.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View arg0) { try{ // TODO Auto-generated method stub if (counter < desc.length -1) counter++; imgView.setImageResource(imgs[counter]); tvDesc.setText(desc[counter]); }catch(Exception e) { Toast.makeText(ImageGallery.this, e.toString(), Toast.LENGTH_SHORT).show(); } } }); Button btnPrev = (Button)findViewById(R.id.btnPre); btnPrev.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub try{ // TODO Auto-generated method stub if (counter > 0) counter--; imgView.setImageResource(imgs[counter]); tvDesc.setText(desc[counter]); }catch(Exception e) { Toast.makeText(ImageGallery.this, e.toString(), Toast.LENGTH_SHORT).show(); } }}); } } <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/ImageView01" android:layout_x="70dip" android:layout_width="200px" android:layout_height="200px" android:layout_y="90dip" > </ImageView> <TextView android:id="@+id/tvDesc" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:layout_x="90px" android:layout_y="300px" /> <Button android:layout_x="47dip" android:layout_height="wrap_content" android:text="Previous" android:layout_width="100px" android:id="@+id/btnPre" android:layout_y="341dip"> </Button> <Button android:layout_x="190dip" android:layout_height="wrap_content" android:text="Next" android:layout_width="100px" android:id="@+id/btnNext" android:layout_y="341dip"> </Button> </AbsoluteLayout>

    Read the article

  • Application icon not transferred to Android device

    - by Praveenb
    I want to deploy my application with Android 2.1 features. I placed an application icon in PNG format in the drawable-ldpi,and drawable-hdpi folders. When I installed to the device, it is not showing the application icon on the home screen of the device. Please help me how to solve this issue?

    Read the article

  • Android HelloGoogleMaps to OSMdroid (Open Street Maps)

    - by birgit
    I am trying to reproduce a working HelloGoogleMaps app in Open Street Maps - but I have trouble including the itemized overlay in OSMdroid. I have looked at several resources but I cannot figure out how to fix the error on OsmItemizedOverlay - I guess I am constructing OsmItemizedOverlay wrongly or have a mixup with OsmItemizedOverlay and ItemizedOverlay? But everything I tried to change just raised more errors... "Implicit super constructor ItemizedOverlay() is undefined. Must explicitly invoke another constructor" "Cannot make a static reference to the non-static method setMarker(Drawable) from the type OverlayItem" - I hope someone can help me getting the class definition straight? Thanks so much! package com.example.osmdroiddemomap; import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.graphics.Point; import android.graphics.drawable.Drawable; import org.osmdroid.api.IMapView; import org.osmdroid.views.*; import org.osmdroid.views.overlay.*; import org.osmdroid.views.overlay.OverlayItem.HotspotPlace; public class OsmItemizedOverlay extends ItemizedOverlay<OverlayItem> { Context mContext; private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); //ERRORS are raised by the following 3 lines: public OsmItemizedOverlay(Drawable defaultMarker, Context context) { OverlayItem.setMarker(defaultMarker); OverlayItem.setMarkerHotspot(HotspotPlace.CENTER); mContext = context; } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } @Override public boolean onSnapToItem(int arg0, int arg1, Point arg2, IMapView arg3) { // TODO Auto-generated method stub return false; } }

    Read the article

  • Changing Image In an ImageButton After Being Clicked?

    - by BuZzZzJaY
    Creating a game in Android using multiple ImageButtons to display an image from the drawable folder and I want to change the button to a different image after the button has been clicked on. Here is the code for my image button: <ImageButton android:id="@+id/b56" android:layout_width="45px" android:layout_height="45px" android:layout_gravity="center_vertical" android:src="@drawable/black" /> I can't find anything about how to change the actual image of the button. You can change the color of the button by using the following code in the java file: b32.setBackgroundColor(0xAA00AA00);

    Read the article

  • Round bottom corners on Android Bitmap?

    - by alex
    Hey all, what would be best practice for clipping the bottom borders of a Bitmap? Just manipulate the Bitmap itself or overlay an alpha mask drawable or ...? The whole story: I've a Listview which looks like the iPhone's grouped UITableView style. I would like to display a Bitmap in the last row, but for now the Bitmap overlaps my custom background drawable of the Listview cell. Thx in advance!

    Read the article

  • Where should I put zoomIn in my MapActivity?

    - by Johny
    I'm writing an Android app, and I'd like to zoomIn as soon as the map has been loaded. I get the following error: java.lang.IllegalArgumentException: width and height must be > 0 This MapActivity - width and height must be > 0 question suggests the problem is the zoomIn() method is in the onCreate() method. But I get same error when I put it in the onResume() method. I've been searching for hours and I can't find anything about it at http://developer.android.com or anywhere else... Also I can't find a way to get the time point the map has been loaded. A "MapLoadedListener" or something like that... EDIT Here is my code: public class AMap extends MapActivity{ private final String LOG_TAG = this.getClass().getSimpleName(); private Context mContext; private Chronometer timer; private TextView tvCountdown; private RelativeLayout rl; private MapView mapView; private MapController mapController; private List<Overlay> mapOverlays; private PlayersOverlay playersOverlay; private Drawable drawable; private Builder endDialog; private ContextThemeWrapper ctw; private Handler mHandler = new Handler(); private Player player = new Player(); private StartTask startTask; private EndTask endTask; private MyDBAdapter mdba; private Cursor playersCursor; private UpdateBroadcastReceiver r; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_view); mContext = AMap.this; // set map mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapView.setFocusable(true); // find the relative layout rl = (RelativeLayout) findViewById(R.id.rl); // set the chronometer timer = (Chronometer) findViewById(R.id.tv_timer); timer.setBackgroundColor(Color.DKGRAY); // set the countdown textview tvCountdown = (TextView) findViewById(R.id.tv_countdown); // Open DB connection and get players Cursor mdba = new MyDBAdapter(mContext); mdba.open(); playersCursor = mdba.getGame(); // Get this player's id and location Intent starter = this.getIntent(); player.setId(starter.getIntExtra("id", 0)); player.setLatitude(starter.getDoubleExtra("lat", 0)); player.setLongitude(starter.getDoubleExtra("lon", 0)); // Set this player's location as map's center GeoPoint geoPoint = new GeoPoint((int) (player.getLatitude()*1E6), (int) (player.getLongitude()*1E6)); mapController = mapView.getController(); mapController.setCenter(geoPoint); mapController.setZoom(15); Log.d(LOG_TAG, "My playersCursor has "+playersCursor.getCount()+" rows"); // drawable is needed but not used drawable = this.getResources().getDrawable(R.drawable.ic_launcher); // set PlayersOverlay (locations and statuses) playersOverlay = new PlayersOverlay(player.getId(), playersCursor, drawable, this); mapOverlays = mapView.getOverlays(); mapOverlays.add(playersOverlay); mHandler.postDelayed(mUpdateTimeTask, 100); } private Runnable mUpdateTimeTask = new Runnable() { public void run() { int h = mapView.getLayoutParams().height; int w = mapView.getLayoutParams().width; Log.d(LOG_TAG, "w = "+w+" , h = "+h); mHandler.postAtTime(this, System.currentTimeMillis() + 1000); } }; @Override public void onAttachedToWindow(){ Log.d(LOG_TAG, "Attached to Window"); int h = mapView.getLayoutParams().height; int w = mapView.getLayoutParams().width; Log.d(LOG_TAG, " Attached to window: w = "+w+" , h = "+h); //mapController.zoomInFixing(screenPoint.x, screenPoint.y); } public void onWindowFocusChanged(boolean hasFocus){ Log.d(LOG_TAG, "Focus changed to: "+hasFocus); int h = mapView.getLayoutParams().height; int w = mapView.getLayoutParams().width; Log.d(LOG_TAG, " Window focus changed: w = "+w+" , h = "+h); //mapController.zoomInFixing(screenPoint.x, screenPoint.y); } @Override protected void onStart(){ super.onStart(); // Create and register the broadcast receiver for messages from service IntentFilter filter = new IntentFilter(AppConstants.iGAME_UPDATE); r = new UpdateBroadcastReceiver(); registerReceiver(r, filter); // Create the dialog for end of game ctw = new ContextThemeWrapper(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); endDialog = new AlertDialog.Builder(ctw); endDialog.setMessage("End of Game"); endDialog.setCancelable(false); endDialog.setNeutralButton("OK", new OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { Intent highScores = new Intent(AMap.this, HighScores.class); startActivity(highScores); playersCursor.close(); finish(); } }); } @Override protected void onStop() { if(!playersCursor.isClosed()) playersCursor.close(); unregisterReceiver(r); mdba.close(); super.onStop(); } @Override protected boolean isRouteDisplayed() { return false; } // Receives signal from NetworkService that DB has been updated public class UpdateBroadcastReceiver extends BroadcastReceiver { boolean startSignal, update, endSignal; @Override public void onReceive(Context context, Intent intent) { endSignal = intent.getBooleanExtra("endSignal", false); if(endSignal){ Log.d(LOG_TAG, "Game Update BroadcastReceiver received End Signal"); endTask = new EndTask(); endTask.execute(); return; } update = intent.getBooleanExtra("update", false); if(update){ Log.d(LOG_TAG, "Game Update BroadcastReceiver received game update"); playersCursor.requery(); mapView.invalidate(); return; } startSignal = intent.getBooleanExtra("startSignal", false); if(startSignal){ Log.d(LOG_TAG, "Game Update BroadcastReceiver received Start Signal"); startTask = new StartTask(); startTask.execute(); return; } } } class StartTask extends AsyncTask<Void,Integer,Void>{ private final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); private final long DELAY = 1200; @Override protected Void doInBackground(Void... params) { int i = 3; while(i>=0){ publishProgress(i); try { Thread.sleep(DELAY); } catch (InterruptedException e) { e.printStackTrace(); } i--; } return null; } @Override protected void onProgressUpdate(Integer... progress){ tg.startTone(ToneGenerator.TONE_PROP_PROMPT); tvCountdown.setText(""+progress[0]); } @Override protected void onPostExecute(Void result) { rl.removeView(tvCountdown); timer.setBase(SystemClock.elapsedRealtime()); timer.start(); //enable screen touches playersOverlay.setGameStarted(true); } } class EndTask extends AsyncTask<Void,Void,Void>{ @Override protected void onPreExecute(){ //disable screen touches playersOverlay.setEndOfGame(true); timer.stop(); } @Override protected Void doInBackground(Void... params) { return null; } @Override protected void onPostExecute(Void result) { try{ endDialog.show(); }catch(Exception e){ Toast.makeText(mContext, "End of game", Toast.LENGTH_LONG); Intent highScores = new Intent(AMap.this, HighScores.class); startActivity(highScores); playersCursor.close(); finish(); } mHandler.removeCallbacks(mUpdateTimeTask); } } }

    Read the article

  • Blending pixels from Two Bitmaps

    - by MarkPowell
    I'm beating my head against a wall here, and I'm fairly certain I'm doing something stupid, so time to make my stupidity public. I'm trying to take two images, blend them together into a third image using standard blending algorithms (Hardlight, softlight, overlay, multiply, etc). Because Android does not have such blend properties build in, I've gone down the path of taking each pixel and combine them using an algorithm. However, the results are garbage. Any help would be appreciated. Below is the code, which I've tried to strip out all the "junk", but some may have made it through. I'll clean it up if something isn't clear. Bitmap src = BitmapFactory.decodeResource(getResources(), R.drawable.base, options); Bitmap mutableBitmap = src.copy(Bitmap.Config.RGB_565, true); int imageId = getResources().getIdentifier("drawable/" + filter, null, getPackageName()); Bitmap filterBitmap = BitmapFactory.decodeResource(getResources(), imageId, options); float scaleWidth = ((float) mutableBitmap.getWidth()) / filterBitmap.getWidth(); float scaleHeight = ((float) mutableBitmap.getHeight()) / filterBitmap.getHeight(); IntBuffer buffSrc = IntBuffer.allocate(src.getWidth() * src.getHeight()); mutableBitmap.copyPixelsToBuffer(buffSrc); buffSrc.rewind(); IntBuffer buffFilter = IntBuffer.allocate(resizedFilterBitmap.getWidth() * resizedFilterBitmap.getHeight()); resizedFilterBitmap.copyPixelsToBuffer(buffFilter); buffFilter.rewind(); IntBuffer buffOut = IntBuffer.allocate(src.getWidth() * src.getHeight()); buffOut.rewind(); while (buffOut.position() < buffOut.limit()) { int filterInt = buffFilter.get(); int srcInt = buffSrc.get(); int alphaValueFilter = Color.alpha(filterInt); int redValueFilter = Color.red(filterInt); int greenValueFilter = Color.green(filterInt); int blueValueFilter = Color.blue(filterInt); int alphaValueSrc = Color.alpha(srcInt); int redValueSrc = Color.red(srcInt); int greenValueSrc = Color.green(srcInt); int blueValueSrc = Color.blue(srcInt); int alphaValueFinal = convert(alphaValueFilter, alphaValueSrc); int redValueFinal = convert(redValueFilter, redValueSrc); int greenValueFinal = convert(greenValueFilter, greenValueSrc); int blueValueFinal = convert(blueValueFilter, blueValueSrc); int pixel = Color.argb(alphaValueFinal, redValueFinal, greenValueFinal, blueValueFinal); buffOut.put(pixel); } buffOut.rewind(); mutableBitmap.copyPixelsFromBuffer(buffOut); BitmapDrawable drawable = new BitmapDrawable(getResources(), mutableBitmap); imageView.setImageDrawable(drawable); } int convert (int in1, int in2) { //simple multiply for example return in1 * in2 / 255; }

    Read the article

  • Why are my images compressed?

    - by Johnny
    I'm using layout xml file for the UI. But the images are compressed and the qualities have lost in some level. My code is like this: <ImageView android:layout_width="480px" android:layout_height="717px" android:layout_x="0px" android:layout_y="45px" android:scaleType="fitXY" android:src="@drawable/e4" /> The drawable is actually 480x717. What's the problem here? Is it due to the fitXY?

    Read the article

  • Why my images are compressed?

    - by Johnny
    I'm using layout xml file for the UI. But the images are compressed and the qualities have lost in some level. My code is like this: <ImageView android:layout_width="480px" android:layout_height="717px" android:layout_x="0px" android:layout_y="45px" android:scaleType="fitXY" android:src="@drawable/e4" /> The drawable is actually 480x717. What's the problem here? Is it due to the fitXY?

    Read the article

  • problem in loading images from web

    - by Lynnooi
    hi, I am new in android and had developed an app which get images from the website and display it. I got it working in emulator but not in real phones. In some device, it will crash or take very long loading period. Can anyone please help me or guide me in improving it as i'm not sure whether the way i loads the images is correct or not. Here are the code i use to get the images from the web and display accordingly. if (xmlURL.length() != 0) { try { URL url = new URL(xmlURL); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); /* Get the XMLReader of the SAXParser we created. */ XMLReader xr = sp.getXMLReader(); /* * Create a new ContentHandler and apply it to the * XML-Reader */ xr.setContentHandler(myExampleHandler); /* Parse the xml-data from our URL. */ xr.parse(new InputSource(url.openStream())); /* Parsing has finished. */ /* * Our ExampleHandler now provides the parsed data to * us. */ ParsedExampleDataSet parsedExampleDataSet = myExampleHandler.getParsedData(); } catch (Exception e) { } } if (s.equalsIgnoreCase("wallpapers")) { Context context = helloAndroid.this.getBaseContext(); for (int j = 0; j <= myExampleHandler.filenames.size() - 1; j++) { if (myExampleHandler.filenames.elementAt(j).toString() != null) { helloAndroid.this.ed = myExampleHandler.thumbs.elementAt(j) .toString(); if (helloAndroid.this.ed.length() != 0) { Drawable image = ImageOperations(context, helloAndroid.this.ed, "image.jpg"); file_info = myExampleHandler.filenames .elementAt(j).toString(); author = "\nby " + myExampleHandler.authors.elementAt(j) .toString(); switch (j + 1) { case 1: ImageView imgView1 = new ImageView(context); imgView1 = (ImageView) findViewById(R.id.image1); if (image.getIntrinsicHeight() > 0) { imgView1.setImageDrawable(image); } else imgView1 .setImageResource(R.drawable.empty_wallpaper); tv = (TextView) findViewById(R.id.filename1); tv.setText(file_info); tv = (TextView) findViewById(R.id.author1); tv.setText(author); imgView1 .setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // Perform action on click Intent myIntent1 = new Intent( helloAndroid.this, galleryFile.class); Bundle b = new Bundle(); b.putString("fileID",myExampleHandler.fileid.elementAt(0).toString()); b.putString("page", "1"); b.putString("family", s); b.putString("fi",myExampleHandler.folder_id.elementAt(folder).toString()); b.putString("kw", keyword); myIntent1.putExtras(b); startActivityForResult( myIntent1, 0); } }); break; case 2: ImageView imgView2 = new ImageView(context); imgView2 = (ImageView) findViewById(R.id.image2); imgView2.setImageDrawable(image); tv = (TextView) findViewById(R.id.filename2); tv.setText(file_info); tv = (TextView) findViewById(R.id.author2); tv.setText(author); imgView2 .setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // Perform action on click Intent myIntent1 = new Intent( helloAndroid.this, galleryFile.class); Bundle b = new Bundle(); b.putString("fileID",myExampleHandler.fileid.elementAt(1).toString()); b.putString("page", "1"); b.putString("family", s); b.putString("fi",myExampleHandler.folder_id.elementAt(folder).toString()); b.putString("kw", keyword); myIntent1.putExtras(b); startActivityForResult( myIntent1, 0); } }); break; case 3: //same code break; } } } } } private Drawable ImageOperations(Context ctx, String url, String saveFilename) { try { InputStream is = (InputStream) this.fetch(url); Drawable d = Drawable.createFromStream(is, "src"); return d; } catch (MalformedURLException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } } public Object fetch(String address) throws MalformedURLException, IOException { URL url = new URL(address); Object content = url.getContent(); return content; }

    Read the article

  • Android AlertDialog with rounded corners: rectangle seen below corners

    - by user1455909
    I want a Dialog with rounded corners, but when the Dialog is seen there's a rectangle below it that's seen below the corners, like this: I build the dialog using a custom DialogFragment: public class MyDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.playdialog, null)); return builder.create(); } } The dialog layout (playdialog) has the following drawable as background: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#AAAAAAAA" /> <stroke android:width="2dp" android:color="#FF000000" /> <corners android:radius="20dp" /> </shape> As I said, I set this drawable as background: android:background="@drawable/dialog_background" I don't want that rectangle to be seen. How can I do it?? In this post the user had the same problem. I tried to use the solution that worked for him but it didn't work for me. I modified my DialogFragment like this: public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.playdialog, null)); Dialog d = builder.create(); d.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); return d; } The result is exactly the same. How can I remove that rectangle? Thanks!

    Read the article

  • Android Home Screen Widget (icon, label - style)

    - by dmulligan
    I'm trying to create an icon/widget (1 cell x 1 cell) that can be placed on the home screen of android. The widget will look and act exactly like the other standard shortcuts in android. It will have an icon and under that a label, it will be selectable with the trackball (highlight able) it will be highlighted when it is selected/clicked. How do I go about creating this home screen widget? Do I have to create the widget myself using code/xml or is there some standard xml, style, theme, code that I can use to ensure that the widget will have the same style/theme as the other home screen widgets? I currently have the following res/drawable/corners.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Corners"> <stroke android:width="4dp" android:color="#CC222222" /> <padding android:left="4dp" android:top="1dp" android:right="4dp" android:bottom="1dp" /> <corners android:radius="4dp" /> </shape> res/layout/widget.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Widget" android:layout_width="72dip" android:layout_height="72dip" android:orientation="vertical" android:focusable="true" android:gravity="center_horizontal" style="@android:style/Widget" > <ImageView android:id="@+id/WidgetIcon" android:src="@drawable/icon" android:layout_width="fill_parent" android:layout_height="50dip" android:paddingTop="3dip" android:gravity="center" /> <TextView android:id="@+id/WidgetLabel" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/app_name" android:textSize="15dip" android:background="@drawable/corners" /> </LinearLayout> The resulting widget looks some what close, but its not selectable, it doesn't get highlighted when clicked and the label isn't exactly in the correct location or the correct style. Any ideas, if there is a correct way to do this, or should I just keep working away on the above until I am closer?

    Read the article

  • How does Android decide which background resource to draw on the foreground?

    - by Sebi
    I defined two ImageButton which are contained in a LinearLayout in my XML layout file: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:minHeight="40px" android:background="@drawable/library_tabs_background"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button_library" android:layout_width="160px" android:paddingTop="7px" android:layout_height="40px" android:paddingLeft="30px" android:orientation="horizontal"> <ImageButton android:id="@+id/list" android:layout_width="110px" android:layout_height="30px" android:src="@drawable/library_tab1_button_active"> </ImageButton> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button_search" android:layout_width="160px" android:paddingTop="7px" android:layout_height="40px" android:orientation="horizontal"> <ImageButton android:id="@+id/search" android:layout_width="110px" android:layout_height="30px" android:src="@drawable/library_tab2_button_deactive"> </ImageButton> </LinearLayout> </LinearLayout> As one can see in the XML file, also the LinearLayout in which the buttons are contained, a background image is set. This two images (the button background and the linearlayout background) are overlapping. So in some views, the button background is in front of the layout background and in other views (im using a view flipper), the background of the layer is in the foreground. How can i set a clear rule? How does Android decide which BackgroundResource to draw first?

    Read the article

  • Android ignores scrollbarsize

    - by Maragues
    Hi, I'm trying to modify a ListView scrollbar's width without success <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:choiceMode="singleChoice" android:scrollbars="vertical" android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track" android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb" android:scrollbarSize="4px" android:clickable="true"/> First I tried using a drawable image 4px wide, but the .png was resized. Then I tried using a shape extracted from SamplesApi, without success. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:width="40px"> <gradient android:startColor="#505050" android:endColor="#C0C0C0" android:angle="0"/> <corners android:radius="0dp" /> I've tried with and without the android:width attribute. There's a question on the same topic (http://stackoverflow.com/questions/2565083/width-of-a-scroll-bar-in-android), but it doesn't try anything different that what I'm already trying. As far as I know, creating my own theme shouldn't change the output. There's an example in SamplesApi (Views/ScrollBars). I tried modifying the scrollbarSize attribute without result. I know about ninepatch images, but there's an attribute which should do what I want. Any hint? Thanks in advance.

    Read the article

  • My Android ListView item layout looks terrible

    - by jnylen
    I wanted to create a layout like the CyanogenMod call log in that there is a list item and a call button on the left which gets focus separately (screenshot). Instead, I get this mess. Here's my code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:minHeight="?android:attr/listPreferredItemHeight" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="4dip" > <DontPressWithParentImageView android:id="@+id/play_icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingLeft="14dip" android:paddingRight="14dip" android:layout_alignParentRight="true" android:gravity="center_vertical" android:src="@drawable/sym_play" android:background="@drawable/play_background" /> <View android:id="@+id/divider" android:layout_width="1px" android:layout_height="fill_parent" android:layout_marginTop="5dip" android:layout_marginBottom="5dip" android:layout_toLeftOf="@id/play_icon" android:layout_marginLeft="2dip" android:background="@drawable/divider_vertical_dark" /> <TextView android:id="@+id/file_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="8dip" android:layout_marginTop="-10dip" android:layout_marginLeft="10dip" android:layout_alignWithParentIfMissing="true" android:singleLine="true" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" /> <TextView android:id="@+id/file_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_above="@id/file_info" android:layout_alignWithParentIfMissing="true" android:layout_marginBottom="-10dip" android:layout_marginLeft="4dip" android:textAppearance="?android:attr/textAppearanceLarge" android:singleLine="true" android:ellipsize="marquee" android:gravity="center_vertical" /> </RelativeLayout> For reference, the code I started with is here and here, and the source to DontPressWithParentImageView is here (but as you can see from my screenshot, that part is working). What am I doing wrong?

    Read the article

  • How can I get the correct DisplayMetrics from an AppWidget in Android?

    - by Gary
    I need to determine the screen density at runtime in an Android AppWidget. I've set up an HDPI emulator device (avd). If set up a regular executable project, and insert this code into the onCreate method: DisplayMetrics dm = getResources().getDisplayMetrics(); Log.d("MyTag", "screen density " + dm.densityDpi); This outputs "screen density 240" as expected. However, if I set up an AppWidget project, and insert this code into the onUpdate method: DisplayMetrics dm = context.getResources().getDisplayMetrics(); Log.d("MyTag", "screen density " + dm.densityDpi); This outputs "screen density 160". I noticed, hooking up the debugger, that the mDefaultDisplay member of the Resources object here is null in the AppWidget case. Similarly, if I get a resource at runtime using the Resources object obtained from context.getResources() in the AppWidget, it returns the wrong resource based on screen density. For instance, I have a 60x60px drawable for mdpi, and an 80x80 drawable for hdpi. If I get this Drawable object using context.getResources().getDrawable(...), it returns the 60x60 version. Is there any way to correctly deal with resources at runtime from the context of an AppWidget? Thanks!

    Read the article

  • Adding a Layout to bottom of the screen inside a ScrollView in Landscape mode

    - by andreea
    I have the following layout which works in Portrait mode: the Layout with the id LinearLayout02 is placed at the bottom of the screen. The problem appears when flipping to Lanscape mode, when the #LinearLayout02 is placed at the top of the screen. The question is how do I position #LinearLayout02 at the bottom of the screen in both Portrait and Landscape mode? (This happens on G1 and Xperia) Thank you The following code is placed inside a ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" android:fillViewport="true" <LinearLayout android:id="@+id/sLayout" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:paddingTop="2dip" android:layout_alignParentTop="true" android:gravity="top" > ..... </LinearLayout> <LinearLayout android:id="@+id/LinearLayout02" android:background="@drawable/bottombar_bg" android:layout_width="fill_parent" android:paddingTop="10dip" android:layout_height="56dip" android:layout_alignParentBottom="true" android:gravity="bottom" > <Button android:id="@+id/navigate" style="@style/mainBottomTabsButtonNormal" android:drawableLeft="@drawable/icon_navigation" android:text="@string/navigationSettings" android:layout_gravity="left"> </Button> <Button android:id="@+id/search" style="@style/mainBottomTabsButtonActive" android:drawableLeft="@drawable/icon_search" android:text="@string/search.label" android:layout_gravity="right"> </Button> </LinearLayout> </RelativeLayout>

    Read the article

  • Android accessibility focus - clicking a view changes focus to previous view

    - by benkdev
    I'm using android TalkBack to test my application for accessibility use. When I swipe to select a view and double tap, the focus returns the the view above it. Usually when swiping to a view and double clicking it, onClick is called. What am I doing wrong? <?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" android:background="@color/all_white" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/header" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/green_bar" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/blue_bar" android:scaleType="center" /> <EditText android:id="@+id/username" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/username" android:focusable="true" android:nextFocusDown="@id/password" /> <EditText android:id="@+id/password" android:inputType="textPassword" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/password" android:focusable="true" android:nextFocusUp="@id/username" android:nextFocusDown="@id/login" /> <Button android:id="@+id/login" android:onClick="doLogin" android:focusable="true" android:layout_width="325dp" android:layout_height="wrap_content" android:text="@string/login" android:nextFocusUp="@id/password" android:nextFocusDown="@id/create_trial_account" /> <Button android:id="@+id/create_trial_account" android:layout_width="100dip" android:layout_height="wrap_content" android:text="@string/new_user" android:onClick="createAccount" android:focusable="true" android:nextFocusUp="@id/login" /> <TextView android:id="@+id/copyright" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/copyright" /> <TextView android:id="@+id/buildNumber" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Android 2.2 SDK breaks compatibility with older phones

    - by Tom
    I have recently updated my app to a build tarket of SDK version 8 in order to include the App2SD feature for my users. However I have had reports of devices on SDK 3 (1.5) having problems starting the application, with the following stack trace: ... E/AndroidRuntime(10638): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/title_bar_shadow.9.png from drawable resource ID #0x7f020000 E/AndroidRuntime(10638): at android.content.res.Resources.loadDrawable(Resources.java:1641) E/AndroidRuntime(10638): at android.content.res.TypedArray.getDrawable(TypedArray.java:548) E/AndroidRuntime(10638): at android.view.View.<init>(View.java:1726) E/AndroidRuntime(10638): at android.view.View.<init>(View.java:1675) E/AndroidRuntime(10638): at android.view.ViewGroup.<init>(ViewGroup.java:271) E/AndroidRuntime(10638): at android.widget.LinearLayout.<init>(LinearLayout.java:92) E/AndroidRuntime(10638): ... 26 more E/AndroidRuntime(10638): Caused by: java.io.FileNotFoundException: res/drawable/title_bar_shadow.9.png E/AndroidRuntime(10638): at android.content.res.AssetManager.openNonAssetNative(Native Method) E/AndroidRuntime(10638): at android.content.res.AssetManager.openNonAsset(AssetManager.java:392) E/AndroidRuntime(10638): at android.content.res.Resources.loadDrawable(Resources.java:1634) E/AndroidRuntime(10638): ... 31 more If i change the build target back to version 4 as it was previously this issue goes away, also if i remove any graphical resources from my XML files this issue goes away! Any help would be much appreciated as i currently have a broken app on the market for many users.

    Read the article

  • focusable row inside table android

    - by Nikitas
    Hello guys, i have in xml a ScrollView which includes one TableLayout. My question is if it's possible to have a focusable row every time i click on it. Here is my xml code: <ScrollView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TableLayout android:id="@+id/table2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TableRow> <RelativeLayout android:id="@+id/rowlayout" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/rowbackground2" > <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_code_contact" android:padding="7dip" android:layout_alignParentLeft="true" /> <TextView android:id="@+id/contacts" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:text="Contacts" android:textColor="#000" android:textSize="18dip" android:layout_toRightOf="@id/icon" android:paddingTop="10dip" /> </RelativeLayout> </TableRow> <TableRow> <Button android:id="@+id/contacts_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/contact_button" /> </TableRow> I have already tried the "focusable="true"" and "focusableInTouchMode="true"" but nothing happened.. thanks in advance

    Read the article

  • Make buttonsize bigger for tablet? Android, Xml

    - by Cornelia G
    I have a android view with 2 buttons centered. I want to change the button sizes to be bigger when I run the app on a tablet because they look ridiculous small there since it is the same size as for the phones. How can I do this? This is my code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#e9e9e9" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerInParent="true" android_layout_gravity= "center" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:src="@drawable/icon_bakgrund_android"> </ImageView> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/TableLayout01" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerInParent="true" > <TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button1" android:layout_width="260dp" android:layout_height="50dp" android:background="@drawable/nybutton" android:layout_below="@+id/button2" android:text="@string/las_sollefteabladet" android:textColor="#ffffff" android:layout_centerHorizontal="true"/> </TableRow> <TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="centerCrop"> <Button android:id="@+id/button2" android:layout_width="260dp" android:layout_height="50dp" android:layout_marginTop="10dp" android:background="@drawable/nybutton" android:layout_centerInParent="true" android:text="@string/annonsorer" android:textColor="#ffffff" /> </TableRow> </TableLayout> </RelativeLayout> </RelativeLayout>

    Read the article

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