Search Results

Search found 11461 results on 459 pages for 'android'.

Page 20/459 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • OrientationEventListener not working properly

    - by nixau
    Hi all, I need to handle orientation changes in my Android application. For this purpose I decided to use OrientationEventListener convenience class. But his callback method is given somewhat strange behavior. My application starts in the portrait mode and then eventually switches to the lanscape one. I have some custom code executing in the callback onOrientationChanged method that provides some additional UI handling logic - it has a few calls to findViewById. What is strange is that when switching back from landscape to portrait mode onOrientationChanged callback is called twice, and what's even worse - the second call is dealing with bad Context - findViewById method starts returning null. These calls are made right from the MainThread @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); listener = new OrientationListener(); } @Override protected void onResume() { super.onResume(); // enabling listening listener.enable(); } @Override protected void onPause() { super.onPause(); // disabling listening listener.disable(); } I've replicated the same behavior with a dummy Activity without any logic except for one that deals with orientation hadling. I initiate orientation switch from the Android 2.2 emulator by pressing Ctrl+F11 What could be wrong? Upd: Inner class that implements OrientationEventListener private class OrientationListener extends OrientationEventListener { public OrientationL() { super(getBaseContext()); } @Override public void onOrientationChanged(int orientation) { toString(); } } }

    Read the article

  • Problems when handling orientation changes

    - by nixau
    Hi all, I need to handle orientation changes in my Android application. For this purpose I decided to use OrientationEventListener convenience class. But his callback method is given somewhat strange behavior. My application starts in the portrait mode and then eventually switches to the lanscape one. I have some custom code executing in the callback onOrientationChanged method that provides some additional UI handling logic - it has a few calls to findViewById. What is strange is that when switching back from landscape to portrait mode onOrientationChanged callback is called twice, and what's even worse - the second call is dealing with bad Context - findViewById method starts returning null. These calls are made right from the MainThread @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); listener = new OrientationListener(); } @Override protected void onResume() { super.onResume(); // enabling listening listener.enable(); } @Override protected void onPause() { super.onPause(); // disabling listening listener.disable(); } I've replicated the same behavior with a dummy Activity without any logic except for one that deals with orientation hadling. I initiate orientation switch from the Android 2.2 emulator by pressing Ctrl+F11 What could be wrong? Upd: Inner class that implements OrientationEventListener private class OrientationListener extends OrientationEventListener { public OrientationL() { super(getBaseContext()); } @Override public void onOrientationChanged(int orientation) { toString(); } } }

    Read the article

  • Can Android 1.6 devices be upgraded to Android 2.x for free?

    - by TimothyP
    I'm a bit confused on what the license/deployment policy for Android is really like. Is it an open source OS in the same sense as let's say a normal Linux distro ? If I have an Android 1.6 device, can I simply install the latest version of Android on it free of charge, or is there a lot more to it ? I take it, it's not just a download and install workflow.

    Read the article

  • Listview selects mutliple items when clicked

    - by xlph
    I'm trying to make a task manager, and I only have one problem. I have a listview that gets inflated. All the elements in the listview are correct. The problem is that when I select an item, the listview will select another item away. I've heard listviews repopulate the list as it scrolls down to save memory. I think this may be some sort of problem. Here is a picture of the problem. If i had more apps loaded, then it would continue to select multiple at once. Here is the code of my adapter and activity and XML associated public class TaskAdapter extends BaseAdapter{ private Context mContext; private List<TaskInfo> mListAppInfo; private PackageManager mPack; public TaskAdapter(Context c, List<TaskInfo> list, PackageManager pack) { mContext = c; mListAppInfo = list; mPack = pack; } @Override public int getCount() { return mListAppInfo.size(); } @Override public Object getItem(int position) { return mListAppInfo.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { TaskInfo entry = mListAppInfo.get(position); if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(mContext); //System.out.println("Setting LayoutInflater in TaskAdapter " +mContext +" " +R.layout.taskinfo +" " +R.id.tmbox); convertView = inflater.inflate(R.layout.taskinfo,null); } ImageView ivIcon = (ImageView)convertView.findViewById(R.id.tmImage); ivIcon.setImageDrawable(entry.getIcon()); TextView tvName = (TextView)convertView.findViewById(R.id.tmbox); tvName.setText(entry.getName()); convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final CheckBox checkBox = (CheckBox)v.findViewById(R.id.tmbox); if(v.isSelected()) { System.out.println("Listview not selected "); //CK.get(arg2).setChecked(false); checkBox.setChecked(false); v.setSelected(false); } else { System.out.println("Listview selected "); //CK.get(arg2).setChecked(true); checkBox.setChecked(true); v.setSelected(true); } } }); return convertView; public class TaskManager extends Activity implements Runnable { private ProgressDialog pd; private TextView ram; private String s; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.taskpage); setTitleColor(Color.YELLOW); Thread thread = new Thread(this); thread.start(); } @Override public void run() { //System.out.println("In Taskmanager Run() Thread"); final PackageManager pm = getPackageManager(); final ListView box = (ListView) findViewById(R.id.cBoxSpace); final List<TaskInfo> CK = populate(box, pm); runOnUiThread(new Runnable() { @Override public void run() { ram.setText(s); box.setAdapter(new TaskAdapter(TaskManager.this, CK, pm)); //System.out.println("In Taskmanager runnable Run()"); endChecked(CK); } }); handler.sendEmptyMessage(0); } Taskinfo.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_horizontal"> <ImageView android:id="@+id/tmImage" android:layout_width="48dp" android:layout_height="48dp" android:scaleType="centerCrop" android:adjustViewBounds="false" android:focusable="false" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tmbox" android:lines="2"/> </LinearLayout> Taskpage.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ListView android:id="@+id/cBoxSpace" android:layout_width="wrap_content" android:layout_height="400dp" android:orientation="vertical"/> <TextView android:id="@+id/RAM" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" /> <Button android:id="@+id/endButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="End Selected Tasks" /> </LinearLayout> Any ideas for what reason mutliple items are selected with a single click would be GREATLY appreciated. I've been messing around with different implementations and listeners and listadapters but to no avail.

    Read the article

  • Adding an overlay to Google maps with path taken

    - by user341652
    Hi, I am trying to write a class to track a person's location(s), and to draw the path they've taken on a MapView. This feature of the program is for the user to track their speed, distance, path, etc. while running/cycling (or whatever else) using their Android phone. This is my first Android application, and I am not sure how to do the Overlay object for the MapView. I also wanted to see if anyone had opinions on the GPS-Tracking part I have written (if it would work, if there is a better way of doing it, code examples would be helpful). I currently have this for my GPSTrackerService: package org.drexel.itrain.logic; import java.util.Vector; import org.drexel.itrain.Constants; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.GpsSatellite; import android.location.GpsStatus; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.location.GpsStatus.Listener; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; public class GPSTrackingService extends Service { private static final int MAX_REASONABLE_SPEED = 60; private static final String TAG = "OGT.TrackingService"; private Context mContext; private LocationManager mLocationManager; private NotificationManager mNotificationManager; private Notification mNotification; private int mSatellites = 0; private int mTrackingState = Constants.GPS_TRACKING_UNKNOWN; private float mCurrentSpeed = 0; private float mTotalDistance = 0; private Location mPreviousLocation; private Vector<Location> mTrackedLocations; private LocationListener mLocationListener = null; private Listener mStatusListener = null; private IBinder binder = null; @Override public void onCreate() { super.onCreate(); this.mContext = getApplicationContext(); this.mLocationManager = (LocationManager) this.mContext.getSystemService( Context.LOCATION_SERVICE ); this.mNotificationManager = (NotificationManager) this.mContext.getSystemService( Context.NOTIFICATION_SERVICE ); this.mTrackedLocations = new Vector<Location>(); this.binder = new Binder(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.mContext); binder = new Binder(); if(mTrackingState != Constants.GPS_TRACKING_UNKNOWN) { createListeners(); } } @Override public void onDestroy() { destroyListeneres(); } @Override public IBinder onBind(Intent intent) { return binder; } @Override public boolean onUnbind(Intent intent) { return true; } public boolean acceptLocation(Location proposedLocation) { if(!(proposedLocation.hasSpeed() || proposedLocation.hasAccuracy())) { return false; } else if(proposedLocation.getSpeed() >= MAX_REASONABLE_SPEED) { return false; } return true; } public void updateNotification() { //TODO Alert that no GPS sattelites are available (or are available) } public void startTracking() { this.mTrackingState = Constants.GPS_TRACKING_STARTED; this.mTotalDistance = 0; this.mCurrentSpeed = 0; this.mTrackedLocations = new Vector<Location>(); this.mPreviousLocation = null; createListeners(); } public void pauseTracking() { this.mTrackingState = Constants.GPS_TRACKING_PAUSED; this.mPreviousLocation = null; this.mCurrentSpeed = 0; } public void resumeTracking() { if(this.mTrackingState == Constants.GPS_TRACKING_STOPPED){ this.startTracking(); } this.mTrackingState = Constants.GPS_TRACKING_STARTED; } public void stopTracking() { this.mTrackingState = Constants.GPS_TRACKING_STOPPED; destroyListeneres(); } private void createListeners() { /** * LocationListener receives locations from */ this.mLocationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onLocationChanged(Location location) { if(mTrackingState == Constants.GPS_TRACKING_STARTED && acceptLocation(location)) { if(mPreviousLocation != null) { //Add the distance between the new location and the previous location mTotalDistance += mPreviousLocation.distanceTo(location); } if(location.hasSpeed()) { mCurrentSpeed = location.getSpeed(); } else { mCurrentSpeed = -1; //-1 means speed N/A } mPreviousLocation = location; mTrackedLocations.add(location); } } }; /** * Receives updates reguarding the GPS Status */ this.mStatusListener = new GpsStatus.Listener() { @Override public synchronized void onGpsStatusChanged(int event) { switch( event ) { case GpsStatus.GPS_EVENT_SATELLITE_STATUS: { GpsStatus status = mLocationManager.getGpsStatus( null ); mSatellites = 0; Iterable<GpsSatellite> list = status.getSatellites(); for( GpsSatellite satellite : list ) { if( satellite.usedInFix() ) { mSatellites++; } } updateNotification(); break; } default: break; } } }; } /** * Destroys the LocationListenere and the GPSStatusListener */ private void destroyListeneres() { this.mLocationListener = null; this.mStatusListener = null; } /** * Gets the total distance traveled by the * * @return the total distance traveled (in meters) */ public float getDistance() { return mTotalDistance; } /** * Gets the current speed of the last good location * * @return the current speed (in meters/second) */ public float getSpeed() { return mCurrentSpeed; } } Any assistance would be much appreciated. This is my group's first Android app, and we are a little pressed for time at the moment. The project is for a class, and is available from SourceForge (currently called iTrain, soon to be renamed). Thanks in Advance, Steve

    Read the article

  • Android : Providing auto autosuggestion in android places Api?

    - by user1787493
    I am very new to android Google maps i write the following program for displaying the auto sugesstion in the android when i am type the text in the Autocomplete text box it is going the input to the url but the out put is not showing in the program .please see once and let me know where i am doing the mistake. package com.example.exampleplaces; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONObject; import org.json.JSONTokener; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.provider.SyncStateContract.Constants; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.widget.AutoCompleteTextView; import android.widget.ProgressBar; public class Place extends Activity { private AutoCompleteTextView mAtv_DestinationLocaiton; public ArrayList<String> autocompletePlaceList; public boolean DestiClick2; private ProgressBar destinationProgBar; private static final String GOOGLE_PLACE_API_KEY = ""; private static final String GOOGLE_PLACE_AUTOCOMPLETE_URL = "https://maps.googleapis.com/maps/api/place/autocomplete/json?"; //https://maps.googleapis.com/maps/api/place/autocomplete/output?parameters @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); autocompletePlaceList = new ArrayList<String>(); destinationProgBar=(ProgressBar)findViewById(R.id.progressBar1); mAtv_DestinationLocaiton = (AutoCompleteTextView) findViewById(R.id.et_govia_destination_location); mAtv_DestinationLocaiton.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { Log.i("Count", "" + count); if (!mAtv_DestinationLocaiton.isPerformingCompletion()) { autocompletePlaceList.clear(); DestiClick2 = false; new loadDestinationDropList().execute(s.toString()); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); } private class loadDestinationDropList extends AsyncTask<String, Void, ArrayList<String>> { @Override protected void onPreExecute() { // Showing progress dialog before sending http request destinationProgBar.setVisibility(View.INVISIBLE); } protected ArrayList<String> doInBackground(String... unused) { try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } autocompletePlaceList = getAutocompletePlaces(mAtv_DestinationLocaiton.getText().toString()); return autocompletePlaceList; } public ArrayList<String> getAutocompletePlaces(String placeName) { String response2 = ""; ArrayList<String> autocompletPlaceList = new ArrayList<String>(); String url = GOOGLE_PLACE_AUTOCOMPLETE_URL + "input=" + placeName + "&sensor=false&key=" + GOOGLE_PLACE_API_KEY; Log.e("MyAutocompleteURL", "" + url); try { //response2 = httpCall.connectToGoogleServer(url); JSONObject jsonObj = (JSONObject) new JSONTokener(response2.trim() .toString()).nextValue(); JSONArray results = (JSONArray) jsonObj.getJSONArray("predictions"); for (int i = 0; i < results.length(); i++) { Log.e("RESULTS", "" + results.getJSONObject(i).getString("description")); autocompletPlaceList.add(results.getJSONObject(i).getString( "description")); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return autocompletPlaceList; } } }

    Read the article

  • Set List View Size Android

    - by Sandeep
    Hello , I am using List View in my project where i have used a xml file which is used to create the list item.Then i have used it programmatically in my class which is extended by ListActivity. But the problem is i have to add a button in the bottom of screen which is not related to list view but List view covers all the screen. So,is there any way to add button in bottom with list view in android. My Code is :- import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; public class Options extends ListActivity { String[] items; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_RIGHT_ICON); items = getResources().getStringArray(R.array.chantOption_array); setListAdapter(new IconicAdapter()); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setBackgroundResource(R.drawable.ichant_logo); setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.icon_t); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // When clicked, show a toast with the TextView text Toast.makeText(getApplicationContext(), items[position], Toast.LENGTH_SHORT).show(); if ("Gayatri Mantra".equals(items[position].toString())) { int[] timeintervals = { 23900, 24000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.gayatri, R.raw.gayatri, R.drawable.icon_gayatri, "Gayatri Mantra", timeintervals); } if ("Om Mani Padme Hum".equals(items[position].toString())) { int[] timeintervals = { 5500, 8200, 11100, 13900, 34100, 36700, 39500, 42300, 59300, 62000, 64800, 67600, 124600 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.ommanipadmehum, R.raw.om_mani, R.drawable.icon_padme, "Om Mani Padme Hum", timeintervals); } if ("Sai Ram".equals(items[position].toString())) { // Audio time interval for bead+total time duration of audio int[] timeintervals = { 4800, 7500, 10400, 12600, 15800, 18600, 21600, 24400, 25000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.sairam, R.raw.sairam, R.drawable.icon_sairam, "Sai Ram", timeintervals); } if ("Aum".equals(items[position].toString())) { // Audio time interval for bead+total time duration of audio int[] timeintervals = { 12850, 13000 }; // startChantActivity(TotalMala_loop,Total_Bead_Loop,BacgroundImage,Icon,Title,BeadsTotalTimeIntervals+totalTimeDurationOfAudio) startChantActivity(2, 108, R.drawable.aum, R.raw.aum, R.drawable.ico_aum, "Aum", timeintervals); } } }); } class IconicAdapter extends ArrayAdapter { IconicAdapter() { super(Options.this, R.layout.list_item, items); } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View row = inflater.inflate(R.layout.list_item, parent, false); TextView label = (TextView) row.findViewById(R.id.label); label.setText(" "+items[position]); ImageView icon = (ImageView) row.findViewById(R.id.icon); if (items[position].equals("Gayatri Mantra")) { icon.setImageResource(R.drawable.icon_gayatri); } if (items[position].equals("Om Mani Padme Hum")) { icon.setImageResource(R.drawable.icon_padme); } if (items[position].equals("Sai Ram")) { icon.setImageResource(R.drawable.icon_sairam); } if (items[position].equals("Aum")) { icon.setImageResource(R.drawable.ico_aum); } return (row); } } protected void startChantActivity(int mala_loop, int beads_loop, int background, int media, int titleIcon, String title, int[] timeintervals) { Bundle bundle = new Bundle(); bundle.putInt("mala_loop", mala_loop); bundle.putInt("beads_loop", beads_loop); bundle.putInt("background", background); bundle.putInt("media", media); bundle.putInt("titleIcon", titleIcon); bundle.putString("title", title); bundle.putIntArray("intervals", timeintervals); Intent intent = new Intent(this, ChantBliss.class); intent.putExtras(bundle); startActivityForResult(intent, this.getSelectedItemPosition()); } } And Corresponding xml file is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:paddingLeft="2px" android:paddingRight="2px" android:paddingTop="2px" android:layout_height="wrap_content" /> <TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="22sp" android:textColor="#ff000000" /> </LinearLayout> Thanks in Advance: Sandeep

    Read the article

  • android database leak found IllegalStateException

    - by saravanan
    04-20 16:53:39.010: ERROR/Database(419): Leak found 04-20 16:53:39.010: ERROR/Database(419): java.lang.IllegalStateException: mPrograms size 1 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteDatabase.finalize(SQLiteDatabase.java:1668) 04-20 16:53:39.010: ERROR/Database(419): at dalvik.system.NativeStart.run(Native Method) 04-20 16:53:39.010: ERROR/Database(419): Caused by: java.lang.IllegalStateException: /data/data/com.example.search/databases/rlite.db SQLiteDatabase created and never closed 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java:1694) 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:738) 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:760) 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:753) 04-20 16:53:39.010: ERROR/Database(419): at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:473) 04-20 16:53:39.010: ERROR/Database(419): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193) 04-20 16:53:39.010: ERROR/Database(419): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98) 04-20 16:53:39.010: ERROR/Database(419): at com.example.search.Database.(Database.java:33) 04-20 16:53:39.010: ERROR/Database(419): at com.example.search.JobDetails.applyJob(JobDetails.java:120) 04-20 16:53:39.010: ERROR/Database(419): at com.example.search.JobDetails.jobdetailsAction(JobDetails.java:98) 04-20 16:53:39.010: ERROR/Database(419): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 16:53:39.010: ERROR/Database(419): at java.lang.reflect.Method.invoke(Method.java:521) 04-20 16:53:39.010: ERROR/Database(419): at android.view.View$1.onClick(View.java:2026) 04-20 16:53:39.010: ERROR/Database(419): at android.view.View.performClick(View.java:2364) 04-20 16:53:39.010: ERROR/Database(419): at android.view.View.onTouchEvent(View.java:4179) 04-20 16:53:39.010: ERROR/Database(419): at android.widget.TextView.onTouchEvent(TextView.java:6540) 04-20 16:53:39.010: ERROR/Database(419): at android.view.View.dispatchTouchEvent(View.java:3709) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 04-20 16:53:39.010: ERROR/Database(419): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 04-20 16:53:39.010: ERROR/Database(419): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 04-20 16:53:39.010: ERROR/Database(419): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 04-20 16:53:39.010: ERROR/Database(419): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 04-20 16:53:39.010: ERROR/Database(419): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 04-20 16:53:39.010: ERROR/Database(419): at android.os.Handler.dispatchMessage(Handler.java:99) 04-20 16:53:39.010: ERROR/Database(419): at android.os.Looper.loop(Looper.java:123) 04-20 16:53:39.010: ERROR/Database(419): at android.app.ActivityThread.main(ActivityThread.java:4363) 04-20 16:53:39.010: ERROR/Database(419): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 16:53:39.010: ERROR/Database(419): at java.lang.reflect.Method.invoke(Method.java:521) 04-20 16:53:39.010: ERROR/Database(419): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 04-20 16:53:39.010: ERROR/Database(419): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 04-20 16:53:39.010: ERROR/Database(419): at dalvik.system.NativeStart.main(Native Method) when i read the database show error like this. please do reply me

    Read the article

  • Android 2.1 GoogleMaps ItemizedOverlay ConcurrentModificationException

    - by Soumya Simanta
    Hi, I cannot figure out the origin of the ConcurrentModificationException. In my activity I'm calling updateMapOverlay(). I'm also calling updateMapOverlay() inside another Thread (a TimerTask) that is invoked on regular intervals. I'm taking the appropriate locks when invoking updateMapOverlay() from both the threads. Is this problem being caused because I'm invoking updateMapOverlay from inside a non-UI thread (i.e., TimerTask). Has anyone else faced a similar issue ? private void updateMapOverlay() { this.itemizedOverlay.refreshItems(createOverlayItemsList()); List<Overlay> overlays = mapView.getOverlays(); overlays.clear(); overlays.add(cotItemizedOverlay); this.mapview.invalidate(); } Thanks. Exception: W/dalvikvm(10641): threadid=3: thread exiting with uncaught exception (group=0x4001b180) E/AndroidRuntime(10641): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime(10641): java.util.ConcurrentModificationException E/AndroidRuntime(10641): at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:64) E/AndroidRuntime(10641): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41) E/AndroidRuntime(10641): at com.google.android.maps.MapView.onDraw(MapView.java:494) E/AndroidRuntime(10641): at android.view.View.draw(View.java:6535) E/AndroidRuntime(10641): at android.view.ViewGroup.drawChild(ViewGroup.java:1531) E/AndroidRuntime(10641): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime(10641): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime(10641): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime(10641): at android.view.View.draw(View.java:6538) E/AndroidRuntime(10641): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime(10641): at android.view.ViewGroup.drawChild(ViewGroup.java:1531) E/AndroidRuntime(10641): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime(10641): at android.view.ViewGroup.drawChild(ViewGroup.java:1529) E/AndroidRuntime(10641): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258) E/AndroidRuntime(10641): at android.view.View.draw(View.java:6538) E/AndroidRuntime(10641): at android.widget.FrameLayout.draw(FrameLayout.java:352) E/AndroidRuntime(10641): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830) E/AndroidRuntime(10641): at android.view.ViewRoot.draw(ViewRoot.java:1349) E/AndroidRuntime(10641): at android.view.ViewRoot.performTraversals(ViewRoot.java:1114) E/AndroidRuntime(10641): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633) E/AndroidRuntime(10641): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(10641): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime(10641): at android.app.ActivityThread.main(ActivityThread.java:4363) E/AndroidRuntime(10641): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(10641): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime(10641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) E/AndroidRuntime(10641): at dalvik.system.NativeStart.main(Native Method) I/Process ( 95): Sending signal. PID: 10641 SIG: 3

    Read the article

  • How to launch activity from android home screen widget

    - by Brian515
    Hi all, I am desperately trying to get my head wrapped around how to implement home screen widgets. Right now, I (finally) was able to get a button on my widget respond to a button press setting up an intent filter in the manifest. However, I cannot for the life of me figure out how to launch an activity when the button is pressed. Basically, here's the code i have: @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if(intent.getAction().equals("com.bic.search.searchWidget.CLICK")) { Toast.makeText(context, "It works!!", Toast.LENGTH_SHORT).show(); } } What I really want to do, though, is start a new activity, not display a toast message. I know it has something to do with pending intents, but I can't figure out how to get that to work. Any help and sample code would be appreciated. Thanks a ton to whoever answers this!

    Read the article

  • Android -- How to position View off-screen?

    - by borg17of20
    Hello all, I'm trying to animate a simple ImageView in my application and I want it to slide in from the bottom of the screen and come to a resting position where the top 50px of the view is off the top of the screen (e.g. the final position of the ImageView should be -50px in X). I've tried to use the AbsoluteLayout to do this, but this actually cuts off the top 50px of the ImageView such that the top 50px is never rendered. I need to have the top 50px of the ImageView visible/rendered while it's animating and then simply have it come to a rest slightly off-screen. I hope I've explained that well enough. Here is what I'm currently using as a layout and the slide-in animation (this currently doesn't render the top 50px of the ImageView): Layout: <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/QuickPlayClipLayout"> <ImageView android:id="@+id/Clip" android:background="@drawable/clip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_y="-50dp"> </ImageView> </AbsoluteLayout> Animation: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="1000"/> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000" /> </set> Thanks in advance.

    Read the article

  • android spinner width problem?

    - by UMMA
    dear friends, i have created following layout. <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TableRow> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Post As" /> <Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ddlPostAs" /> </TableRow> <TableRow> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Expires In" /> <Spinner android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ddlExpiryOn" /> </TableRow> </TableLayout> in which android spinner changes its width according to the data. i want to stop it. can any one guide me how to achieve this? any help would be appriciated.

    Read the article

  • Xamarin Designer for Android Webinar - Recording

    - by Wallym
    Here is some info on the recording of the webinar that I did last week for AppDev regarding the Xamarin Designer for Android.Basic Info: Android user interfaces can be created declaratively by using XML files, or programmatically in code. The Xamarin Android Designer allows developers to create and modify declarative layouts visually, without having to deal with the tedium of hand-editing XML files. The designer also provides real-time feedback, which lets the developer validate changes without having to redeploy the application in order to test a design. This can speed up UI development in Android tremendously. In this webinar, we'll take a look at UI Design in Mono for Android, the basics of the Xamarin Android Designer, and build a simple application with the designer.Here is the link:http://media.appdev.com/EDGE/LL/livelearn05232012.wmvI think it will only play in Internet Explorer.  Enjoy!

    Read the article

  • Stop Progressbar manual scrolling in Android

    - by Rony
    Hi experts, I have already posted my query here, but unfortunately, not getting the required support for this simple query. http://www.anddev.org/prevent_manual_moving_of_seekbar_widget-t13048.html I am using progressbar widget in my application to show the download progress. In the current state, I am able to manually move the slider back and forth while download is progressing. How can I prevent the manual moving of progressbar, instead it works only based on progressbar.setProgress(progressbar.getProgress() + 1024); -- currently this works perfect, but I need to prevent the manual moving of progressbar during download. Any help in this regard is appreciated. Regards, Rony

    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

  • 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

  • Android Application Crashel

    - by deewangan
    hello everyone, i am trying to run an application on an android emulator, but it crashes. i am following a howto i don't know what to do, it just crashes. other applications are running fine, can anyone tell me what i am doing wrong.here is the code: public class Finder extends Activity { /** Called when the activity is first created. */ private LocationManager myLocationManager; private LocationListener myLocationListener; private TextView myLatitude, myLongitude; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myLatitude = (TextView)findViewById(R.id.Latitude); myLongitude = (TextView)findViewById(R.id.Longitude); myLocationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); myLocationListener = new MyLocationListener(); myLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,myLocationListener); myLatitude.setText(String.valueOf( myLocationManager.getLastKnownLocation( LocationManager.GPS_PROVIDER).getLatitude())); myLongitude.setText(String.valueOf( myLocationManager.getLastKnownLocation( LocationManager.GPS_PROVIDER).getLongitude())); } private class MyLocationListener implements LocationListener{ public void onLocationChanged(Location argLocation) { // TODO Auto-generated method stub myLatitude.setText(String.valueOf( argLocation.getLatitude())); myLongitude.setText(String.valueOf( argLocation.getLongitude())); } public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } }; } i looked in the logcat after running the application, it seems that the following lines are cause of the problem but i don't understand it:( 01-18 22:12:46.017: WARN/dalvikvm(1091): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) 01-18 22:12:46.017: ERROR/AndroidRuntime(1091): Uncaught handler: thread main exiting due to uncaught exception 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): java.lang.RuntimeException: Unable to start activity ComponentInfo{pro.googleLocation/pro.googleLocation.Finder}: java.lang.NullPointerException 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.os.Handler.dispatchMessage(Handler.java:99) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.os.Looper.loop(Looper.java:123) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread.main(ActivityThread.java:4203) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at java.lang.reflect.Method.invokeNative(Native Method) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at java.lang.reflect.Method.invoke(Method.java:521) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at dalvik.system.NativeStart.main(Native Method) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): Caused by: java.lang.NullPointerException 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at pro.googleLocation.Finder.onCreate(Finder.java:28) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) 01-18 22:12:46.037: ERROR/AndroidRuntime(1091): ... 11 more

    Read the article

  • Find package name for Android apps to use Intent to launch Market app

    - by eom
    I'm creating a mobile website that will include a page from which people can download relevant apps that we recommend. I've found good instructions for creating the links to launch the Market but this assumes that you are the developer of the app in question and know the exact package name. Is there any way to get the package name, other than just contacting the developers and asking? For the iPhone, I found easy instructions for getting the URL I need from the iTunes store, so I'm looking for info like that.

    Read the article

  • Android TextView Linkify problem with phone numbers and application version number

    - by Gaks
    I have a problem with TextView and autoLink feature. I have an about screen in my application with some information like support phone number, email address, website URL and application version in form like 01.01.01 After setting autoLink="all" on the textView, all values are linked fine - except that version number 01.01.01 is linked as the phone number as well. Is there some way to exclude this text fragment from linkifing?

    Read the article

  • Ghost activity in android

    - by Ari
    My application works as follow: On start I have some AppStartActivity which does something, finishes itself and starts MainActivity if user is logged in or LoginActivity otherwise. LoginActivity finishes itself and starts MainActivity when user log in successfully. On MainActivity I have SomeActivity from which user can logout. Activity stack for this situation is MainActivity > SomeActivity. It is correct, back button works well. When user click LogOut button there is a problem. I need to show LoginActivity but I don't want to have MainActivity and SomeActivity on activity stack anymore. I could resolve this problem if I wouldn't finish AppStartActivity. I could go back then with flag FLAG_ACTIVITY_CLEAR_TOP and it would work well. But here is a problem with back button. I don't want user to come back to this activity with back button. I want it to exit app instead. UPDATED: Flags FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK would be best, but I need it working in API level 9.

    Read the article

  • Android Activity ClassNotFoundException - tried everything

    - by Matthew Rathbone
    I've just refactored an app into a framework library and an application, but now when I try and start the app in the emulator I get the following error stack trace: 06-02 18:22:35.529: E/AndroidRuntime(586): FATAL EXCEPTION: main 06-02 18:22:35.529: E/AndroidRuntime(586): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.matthewrathbone.eastersays/com.matthewrathbone.eastersays.EasterSimonSaysActivity}: java.lang.ClassNotFoundException: com.matthewrathbone.eastersays.EasterSimonSaysActivity in loader dalvik.system.PathClassLoader[/data/app/com.matthewrathbone.eastersays-1.apk] 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.os.Handler.dispatchMessage(Handler.java:99) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.os.Looper.loop(Looper.java:123) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread.main(ActivityThread.java:4627) 06-02 18:22:35.529: E/AndroidRuntime(586): at java.lang.reflect.Method.invokeNative(Native Method) 06-02 18:22:35.529: E/AndroidRuntime(586): at java.lang.reflect.Method.invoke(Method.java:521) 06-02 18:22:35.529: E/AndroidRuntime(586): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 06-02 18:22:35.529: E/AndroidRuntime(586): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 06-02 18:22:35.529: E/AndroidRuntime(586): at dalvik.system.NativeStart.main(Native Method) 06-02 18:22:35.529: E/AndroidRuntime(586): Caused by: java.lang.ClassNotFoundException: com.matthewrathbone.eastersays.EasterSimonSaysActivity in loader dalvik.system.PathClassLoader[/data/app/com.matthewrathbone.eastersays-1.apk] 06-02 18:22:35.529: E/AndroidRuntime(586): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 06-02 18:22:35.529: E/AndroidRuntime(586): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 06-02 18:22:35.529: E/AndroidRuntime(586): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 06-02 18:22:35.529: E/AndroidRuntime(586): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 06-02 18:22:35.529: E/AndroidRuntime(586): ... 11 more Usually this means that the manifest file is wrong in some way, but I've double checked everything I can think of. Here is my activity class: package com.matthewrathbone.eastersays; import android.os.Bundle; import com.rathboma.simonsays.Assets.Season; import com.rathboma.simonsays.SeasonPicker; import com.rathboma.simonsays.SimonSaysActivity; public class EasterSimonSaysActivity extends SimonSaysActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); } @Override public SeasonPicker getSeasonPicker() { return new SeasonPicker(){ @Override public Season getSeason() { // TODO Auto-generated method stub return Season.EASTER; } }; } } As you can see, it's listed correctly in the manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.matthewrathbone.eastersays" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".EasterSimonSaysActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> I have no idea how to fix this, and would appreciate any help. I've scanned many similar questions on SO without seeing this particular behavior. More info: I've checked inside the generated APK and the class has an entry in the classes.dex file I've tried cleaning/building the project in eclipse I've tried using a totally new device image that doesn't have a copy of the APK on it already I've changed the library project into a regular java, then changed back into an android project, no difference

    Read the article

  • android camera preview blank screen

    - by user1104836
    I want to capture a photo manually not by using existing camera apps. So i made this Activity: public class CameraActivity extends Activity { private Camera mCamera; private Preview mPreview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); // Create an instance of Camera // mCamera = Camera.open(0); // Create our Preview view and set it as the content of our activity. mPreview = new Preview(this); mPreview.safeCameraOpen(0); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); } @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_camera, menu); return true; } } This is the CameraPreview which i want to use: public class Preview extends ViewGroup implements SurfaceHolder.Callback { SurfaceView mSurfaceView; SurfaceHolder mHolder; //CAM INSTANCE ================================ private Camera mCamera; List<Size> mSupportedPreviewSizes; //============================================= /** * @param context */ public Preview(Context context) { super(context); mSurfaceView = new SurfaceView(context); addView(mSurfaceView); // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = mSurfaceView.getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } /** * @param context * @param attrs */ public Preview(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } /** * @param context * @param attrs * @param defStyle */ public Preview(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see android.view.ViewGroup#onLayout(boolean, int, int, int, int) */ @Override protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { // TODO Auto-generated method stub } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // Now that the size is known, set up the camera parameters and begin // the preview. Camera.Parameters parameters = mCamera.getParameters(); parameters.setPreviewSize(width, height); requestLayout(); mCamera.setParameters(parameters); /* Important: Call startPreview() to start updating the preview surface. Preview must be started before you can take a picture. */ mCamera.startPreview(); } @Override public void surfaceCreated(SurfaceHolder holder) { // TODO Auto-generated method stub } @Override public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return, so stop the preview. if (mCamera != null) { /* Call stopPreview() to stop updating the preview surface. */ mCamera.stopPreview(); } } /** * When this function returns, mCamera will be null. */ private void stopPreviewAndFreeCamera() { if (mCamera != null) { /* Call stopPreview() to stop updating the preview surface. */ mCamera.stopPreview(); /* Important: Call release() to release the camera for use by other applications. Applications should release the camera immediately in onPause() (and re-open() it in onResume()). */ mCamera.release(); mCamera = null; } } public void setCamera(Camera camera) { if (mCamera == camera) { return; } stopPreviewAndFreeCamera(); mCamera = camera; if (mCamera != null) { List<Size> localSizes = mCamera.getParameters().getSupportedPreviewSizes(); mSupportedPreviewSizes = localSizes; requestLayout(); try { mCamera.setPreviewDisplay(mHolder); } catch (IOException e) { e.printStackTrace(); } /* Important: Call startPreview() to start updating the preview surface. Preview must be started before you can take a picture. */ mCamera.startPreview(); } } public boolean safeCameraOpen(int id) { boolean qOpened = false; try { releaseCameraAndPreview(); mCamera = Camera.open(id); mCamera.startPreview(); qOpened = (mCamera != null); } catch (Exception e) { // Log.e(R.string.app_name, "failed to open Camera"); e.printStackTrace(); } return qOpened; } Camera.PictureCallback mPicCallback = new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { // TODO Auto-generated method stub Log.d("lala", "pic is taken"); } }; public void takePic() { mCamera.startPreview(); // mCamera.takePicture(null, mPicCallback, mPicCallback); } private void releaseCameraAndPreview() { this.setCamera(null); if (mCamera != null) { mCamera.release(); mCamera = null; } } } This is the Layout of CameraActivity: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".CameraActivity" > <FrameLayout android:id="@+id/camera_preview" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" /> <Button android:id="@+id/button_capture" android:text="Capture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </LinearLayout> But when i start the CameraActivity, i just see a blank white background and the Capture-Button??? Why i dont see the Camera-Screen?

    Read the article

  • Reference for good Android UI design patterns.

    - by sat
    Hi, I would like to get some links for getting started with design patterns.My requirement is , (at Initial stage) How to go about developing a particular pattern , say customized ListView which can be shared across applications . e.g. Applications will call something like drawCustomizedListView(params...) and my code will draw the listview according to the parameters supplied. This is particularly useful when across the applications I have to draw customized views. My intention is, I should not repeat the same code everywhere for doing similar task. Any references for the above requirement ?

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >