Search Results

Search found 12035 results on 482 pages for 'android emulator'.

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

  • Example: Communication between Activity and Service using Messaging

    - by Lance Lefebure
    I couldn't find any examples of how to send messages between an activity and a service, and spent far too many hours figuring this out. Here is an example project for others to reference. This example allows you to start or stop a service directly, and separately bind/unbind from the service. When the service is running, it increments a number at 10Hz. If the activity is bound to the service, it will display the current value. Data is transferred as an Integer and as a String so you can see how to do that two different ways. There are also buttons in the activity to send messages to the service (changes the increment-by value). Screenshot: AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.exampleservice" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <service android:name=".MyService"></service> </application> <uses-sdk android:minSdkVersion="8" /> </manifest> res\values\strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">ExampleService</string> <string name="service_started">Example Service started</string> <string name="service_label">Example Service Label</string> </resources> res\layout\main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/btnStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Start Service"></Button> <Button android:id="@+id/btnStop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Stop Service" android:layout_alignParentRight="true"></Button> </RelativeLayout> <RelativeLayout android:id="@+id/RelativeLayout02" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/btnBind" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Bind to Service"></Button> <Button android:id="@+id/btnUnbind" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unbind from Service" android:layout_alignParentRight="true"></Button> </RelativeLayout> <TextView android:id="@+id/textStatus" android:textSize="24sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Status Goes Here" /> <TextView android:id="@+id/textIntValue" android:textSize="24sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Integer Value Goes Here" /> <TextView android:id="@+id/textStrValue" android:textSize="24sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="String Value Goes Here" /> <RelativeLayout android:id="@+id/RelativeLayout03" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/btnUpby1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Increment by 1"></Button> <Button android:id="@+id/btnUpby10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Increment by 10" android:layout_alignParentRight="true"></Button> </RelativeLayout> </LinearLayout> src\com.exampleservice\MainActivity.java: package com.exampleservice; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { Button btnStart, btnStop, btnBind, btnUnbind, btnUpby1, btnUpby10; TextView textStatus, textIntValue, textStrValue; Messenger mService = null; boolean mIsBound; final Messenger mMessenger = new Messenger(new IncomingHandler()); class IncomingHandler extends Handler { @Override public void handleMessage(Message msg) { switch (msg.what) { case MyService.MSG_SET_INT_VALUE: textIntValue.setText("Int Message: " + msg.arg1); break; case MyService.MSG_SET_STRING_VALUE: String str1 = msg.getData().getString("str1"); textStrValue.setText("Str Message: " + str1); break; default: super.handleMessage(msg); } } } private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { mService = new Messenger(service); textStatus.setText("Attached."); try { Message msg = Message.obtain(null, MyService.MSG_REGISTER_CLIENT); msg.replyTo = mMessenger; mService.send(msg); } catch (RemoteException e) { // In this case the service has crashed before we could even do anything with it } } public void onServiceDisconnected(ComponentName className) { // This is called when the connection with the service has been unexpectedly disconnected - process crashed. mService = null; textStatus.setText("Disconnected."); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnStart = (Button)findViewById(R.id.btnStart); btnStop = (Button)findViewById(R.id.btnStop); btnBind = (Button)findViewById(R.id.btnBind); btnUnbind = (Button)findViewById(R.id.btnUnbind); textStatus = (TextView)findViewById(R.id.textStatus); textIntValue = (TextView)findViewById(R.id.textIntValue); textStrValue = (TextView)findViewById(R.id.textStrValue); btnUpby1 = (Button)findViewById(R.id.btnUpby1); btnUpby10 = (Button)findViewById(R.id.btnUpby10); btnStart.setOnClickListener(btnStartListener); btnStop.setOnClickListener(btnStopListener); btnBind.setOnClickListener(btnBindListener); btnUnbind.setOnClickListener(btnUnbindListener); btnUpby1.setOnClickListener(btnUpby1Listener); btnUpby10.setOnClickListener(btnUpby10Listener); restoreMe(savedInstanceState); CheckIfServiceIsRunning(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("textStatus", textStatus.getText().toString()); outState.putString("textIntValue", textIntValue.getText().toString()); outState.putString("textStrValue", textStrValue.getText().toString()); } private void restoreMe(Bundle state) { if (state!=null) { textStatus.setText(state.getString("textStatus")); textIntValue.setText(state.getString("textIntValue")); textStrValue.setText(state.getString("textStrValue")); } } private void CheckIfServiceIsRunning() { //If the service is running when the activity starts, we want to automatically bind to it. if (MyService.isRunning()) { doBindService(); } } private OnClickListener btnStartListener = new OnClickListener() { public void onClick(View v){ startService(new Intent(MainActivity.this, MyService.class)); } }; private OnClickListener btnStopListener = new OnClickListener() { public void onClick(View v){ doUnbindService(); stopService(new Intent(MainActivity.this, MyService.class)); } }; private OnClickListener btnBindListener = new OnClickListener() { public void onClick(View v){ doBindService(); } }; private OnClickListener btnUnbindListener = new OnClickListener() { public void onClick(View v){ doUnbindService(); } }; private OnClickListener btnUpby1Listener = new OnClickListener() { public void onClick(View v){ sendMessageToService(1); } }; private OnClickListener btnUpby10Listener = new OnClickListener() { public void onClick(View v){ sendMessageToService(10); } }; private void sendMessageToService(int intvaluetosend) { if (mIsBound) { if (mService != null) { try { Message msg = Message.obtain(null, MyService.MSG_SET_INT_VALUE, intvaluetosend, 0); msg.replyTo = mMessenger; mService.send(msg); } catch (RemoteException e) { } } } } void doBindService() { bindService(new Intent(this, MyService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true; textStatus.setText("Binding."); } void doUnbindService() { if (mIsBound) { // If we have received the service, and hence registered with it, then now is the time to unregister. if (mService != null) { try { Message msg = Message.obtain(null, MyService.MSG_UNREGISTER_CLIENT); msg.replyTo = mMessenger; mService.send(msg); } catch (RemoteException e) { // There is nothing special we need to do if the service has crashed. } } // Detach our existing connection. unbindService(mConnection); mIsBound = false; textStatus.setText("Unbinding."); } } @Override protected void onDestroy() { super.onDestroy(); try { doUnbindService(); } catch (Throwable t) { Log.e("MainActivity", "Failed to unbind from the service", t); } } } src\com.exampleservice\MyService.java: package com.exampleservice; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.util.Log; public class MyService extends Service { private NotificationManager nm; private Timer timer = new Timer(); private int counter = 0, incrementby = 1; private static boolean isRunning = false; ArrayList<Messenger> mClients = new ArrayList<Messenger>(); // Keeps track of all current registered clients. int mValue = 0; // Holds last value set by a client. static final int MSG_REGISTER_CLIENT = 1; static final int MSG_UNREGISTER_CLIENT = 2; static final int MSG_SET_INT_VALUE = 3; static final int MSG_SET_STRING_VALUE = 4; final Messenger mMessenger = new Messenger(new IncomingHandler()); // Target we publish for clients to send messages to IncomingHandler. @Override public IBinder onBind(Intent intent) { return mMessenger.getBinder(); } class IncomingHandler extends Handler { // Handler of incoming messages from clients. @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_REGISTER_CLIENT: mClients.add(msg.replyTo); break; case MSG_UNREGISTER_CLIENT: mClients.remove(msg.replyTo); break; case MSG_SET_INT_VALUE: incrementby = msg.arg1; break; default: super.handleMessage(msg); } } } private void sendMessageToUI(int intvaluetosend) { for (int i=mClients.size()-1; i>=0; i--) { try { // Send data as an Integer mClients.get(i).send(Message.obtain(null, MSG_SET_INT_VALUE, intvaluetosend, 0)); //Send data as a String Bundle b = new Bundle(); b.putString("str1", "ab" + intvaluetosend + "cd"); Message msg = Message.obtain(null, MSG_SET_STRING_VALUE); msg.setData(b); mClients.get(i).send(msg); } catch (RemoteException e) { // The client is dead. Remove it from the list; we are going through the list from back to front so this is safe to do inside the loop. mClients.remove(i); } } } @Override public void onCreate() { super.onCreate(); Log.i("MyService", "Service Started."); showNotification(); timer.scheduleAtFixedRate(new TimerTask(){ public void run() {onTimerTick();}}, 0, 100L); isRunning = true; } private void showNotification() { nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); // In this sample, we'll use the same text for the ticker and the expanded notification CharSequence text = getText(R.string.service_started); // Set the icon, scrolling text and timestamp Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis()); // The PendingIntent to launch our activity if the user selects this notification PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); // Set the info for the views that show in the notification panel. notification.setLatestEventInfo(this, getText(R.string.service_label), text, contentIntent); // Send the notification. // We use a layout id because it is a unique number. We use it later to cancel. nm.notify(R.string.service_started, notification); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i("MyService", "Received start id " + startId + ": " + intent); return START_STICKY; // run until explicitly stopped. } public static boolean isRunning() { return isRunning; } private void onTimerTick() { Log.i("TimerTick", "Timer doing work." + counter); try { counter += incrementby; sendMessageToUI(counter); } catch (Throwable t) { //you should always ultimately catch all exceptions in timer tasks. Log.e("TimerTick", "Timer Tick Failed.", t); } } @Override public void onDestroy() { super.onDestroy(); if (timer != null) {timer.cancel();} counter=0; nm.cancel(R.string.service_started); // Cancel the persistent notification. Log.i("MyService", "Service Stopped."); isRunning = false; } }

    Read the article

  • Running Android emulator inside a Virtualbox Vm

    - by sgargan
    I'm trying to setup a VM with a complete android development stack (SDK, Platforms, Eclipse etc) for a Hackathon. I'm having real trouble getting the emulator to start in the VM. I realize that the emulator is essentially a VM itself inside the Vbox VM and so is going to be slow, but it just hangs at the Android splash screen and never gets any further. Might there be something going on with the VM that is causing it to run so very slowly? Is there anything I can do to give the VM more CPU? I've tried setting the execution cap to 100% but it didn't help any. Anyone know what might be going on here, or have any ideas about how I might speed it up? Thanks Steve.

    Read the article

  • Process: Unable to start service com.google.android.gms.checkin.CheckinService with Intent

    - by AndyRoid
    I'm trying to build a Google map application but keep receiving this in my LogCat. I have all the permissions and meta-data set in my manifest, but am still dumbfounded by this error. Have looked everywhere on SO for this specific error but found nothing relating to com.google.android.gms.checkin A little bit about my structural hierarchy. MainActivity extends ActionBarActivity with three tabs underneath actionbar. Each tab has it's own fragment. On the gMapFragment I create a GPSTrack object from my GPSTrack class which extends Service and implements LocationListener. The problem is that when I start the application I get this message: I have all my libraries imported properly and I even added the google-play-services.jar into my libs folder. I also installed Google Play Services APKs through CMD onto my emulator. Furthermore the LocationManager lm = = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); in my GPSTrack class always returns null. Why is this and how can I fix these issues? Would appreciate an explanation along with solution too, I want to understand what's going on here. ============== Code: gMapFragment.java public class gMapFragment extends SupportMapFragment { private final String TAG = "gMapFragment"; private GoogleMap mMap; protected SupportMapFragment mapFrag; private Context mContext = getActivity(); private static View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) { parent.removeView(view); } } try { super.onCreateView(inflater, container, savedInstanceState); view = inflater.inflate(R.layout.fragment_map, container, false); setupGoogleMap(); } catch (Exception e) { /* * Map already there , just return as view */ } return view; } private void setupGoogleMap() { mapFrag = (SupportMapFragment) getFragmentManager().findFragmentById( R.id.mapView); if (mapFrag == null) { FragmentManager fragManager = getFragmentManager(); FragmentTransaction fragTransaction = fragManager .beginTransaction(); mapFrag = SupportMapFragment.newInstance(); fragTransaction.replace(R.id.mapView, mapFrag).commit(); } if (mapFrag != null) { mMap = mapFrag.getMap(); if (mMap != null) { setupMap(); mMap.setOnMapClickListener(new OnMapClickListener() { @Override public void onMapClick(LatLng point) { // TODO your click stuff on map } }); } } } @Override public void onAttach(Activity activity) { super.onAttach(activity); Log.d("Attach", "on attach"); } @Override public void onDetach() { super.onDetach(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); } @Override public void onPause() { super.onPause(); } @Override public void onDestroy() { super.onDestroy(); } private void setupMap() { GPSTrack gps = new GPSTrack(mContext); // Enable MyLocation layer of google map mMap.setMyLocationEnabled(true); Log.d(TAG, "MyLocation enabled"); // Set Map type mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); // Grab current location **ERROR HERE/Returns Null** Location location = gps.getLocation(); Log.d(TAG, "Grabbing location..."); if (location != null) { Log.d(TAG, "location != null"); // Grab Latitude and Longitude double latitude = location.getLatitude(); double longitude = location.getLongitude(); Log.d(TAG, "Getting lat, long.."); // Initialize LatLng object LatLng latLng = new LatLng(latitude, longitude); Log.d(TAG, "LatLng initialized"); // Show current location on google map mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Zoom in on google map mMap.animateCamera(CameraUpdateFactory.zoomTo(20)); mMap.addMarker(new MarkerOptions().position( new LatLng(latitude, longitude)).title("You are here.")); } else { gps.showSettingsAlert(); } } } GPSTrack.java public class GPSTrack extends Service implements LocationListener{ private final Context mContext; private boolean isGPSEnabled = false; //See if network is connected to internet private boolean isNetworkEnabled = false; //See if you can grab the location private boolean canGetLocation = false; protected Location location = null; protected double latitude; protected double longitude; private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 10; //10 Meters private static final long MINIMUM_TIME_CHANGE_FOR_UPDATES = 1000 * 60 * 1; //1 minute protected LocationManager locationManager; public GPSTrack(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { //Setup locationManager for controlling location services **ERROR HERE/Return Null** locationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); //See if GPS is enabled isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); //See if Network is connected to the internet or carrier service isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled && !isNetworkEnabled) { Toast.makeText(getApplicationContext(), "No Network Provider Available", Toast.LENGTH_SHORT).show(); } else { this.canGetLocation = true; if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MINIMUM_TIME_CHANGE_FOR_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS", "GPS Enabled"); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } } } catch (Exception e) { e.printStackTrace(); } return location; } public void stopUsingGPS() { if (locationManager != null) { locationManager.removeUpdates(GPSTrack.this); } } public double getLatitude() { if (location != null) { latitude = location.getLatitude(); } return latitude; } public double getLongitude() { if (location != null) { longitude = location.getLongitude(); } return longitude; } public boolean canGetLocation() { return this.canGetLocation; } public void showSettingsAlert() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext); //AlertDialog title alertDialog.setTitle("GPS Settings"); //AlertDialog message alertDialog.setMessage("GPS is not enabled. Do you want to go to Settings?"); alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); mContext.startActivity(i); } }); alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } }); alertDialog.show(); } @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub } @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 IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } } logcat 06-08 22:35:03.441: E/AndroidRuntime(1370): FATAL EXCEPTION: main 06-08 22:35:03.441: E/AndroidRuntime(1370): Process: com.google.android.gms, PID: 1370 06-08 22:35:03.441: E/AndroidRuntime(1370): java.lang.RuntimeException: Unable to start service com.google.android.gms.checkin.CheckinService@b1094e48 with Intent { cmp=com.google.android.gms/.checkin.CheckinService }: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2719) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.access$2100(ActivityThread.java:135) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.os.Handler.dispatchMessage(Handler.java:102) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.os.Looper.loop(Looper.java:136) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-08 22:35:03.441: E/AndroidRuntime(1370): at java.lang.reflect.Method.invokeNative(Native Method) 06-08 22:35:03.441: E/AndroidRuntime(1370): at java.lang.reflect.Method.invoke(Method.java:515) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 06-08 22:35:03.441: E/AndroidRuntime(1370): at dalvik.system.NativeStart.main(Native Method) 06-08 22:35:03.441: E/AndroidRuntime(1370): Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10053 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ContextImpl.enforce(ContextImpl.java:1685) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1714) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:572) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.c(SourceFile:107) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.a(SourceFile:121) 06-08 22:35:03.441: E/AndroidRuntime(1370): at imq.a(SourceFile:227) 06-08 22:35:03.441: E/AndroidRuntime(1370): at bwq.c(SourceFile:166) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.google.android.gms.checkin.CheckinService.a(SourceFile:237) 06-08 22:35:03.441: E/AndroidRuntime(1370): at com.google.android.gms.checkin.CheckinService.onStartCommand(SourceFile:211) 06-08 22:35:03.441: E/AndroidRuntime(1370): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702) AndroidManifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="com.curio.permission.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.app.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AI........................" /> </application>

    Read the article

  • Emulator restarts after snapshot load

    - by reox
    I've set up a android emulator with a snapshot of a specific state i need to go back every time. the snapshot is created and is listed and i can also start directly with this snapshot with emulator -avd MyAVD -snapshot mystate -no-snapshot-save the problem is now that the emulator restart itselfs after i load the snapshot after i did my changes in the emulator. So if i use echo -e "avd snapshot load mystate\nexit" | nc localhost 5554 the snapshot is loaded correctly but then after some seconds i see the bootloader screen. Whats happening there? this phenomen is repeatable with different emulators and different snapshots. is it possible that i just misuse a feature here? edit: it seems this problem is only occuring when i load a snapshot multiple times. after starting the emulator, everything is working quite well. now i load my snapshot, also everything is working well. but when i now load the same snapshot again, it will correctly load it but then the emulator will restart. so is there any possibility to load a snapshot multiple times? otherwise i always need to restart my emulator, which takes a long time...

    Read the article

  • Resizing layouts for orientation change?

    - by Cole
    Normal: Landscape: See how the ListView overlaps other things on the screen when in landscape mode? How can I keep this from happening? XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/main" > <RelativeLayout android:id="@+id/myWishLists" android:layout_width="fill_parent" android:layout_height="50dp"> <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:prompt="@string/optionsSpinner" android:entries="@array/options" /> </RelativeLayout> <TextView android:id="@+id/myListsText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/myWishLists" android:layout_centerHorizontal="true" android:text="My Wish Lists" android:textStyle="bold" android:textAppearance="?android:attr/textAppearanceLarge" /> <RelativeLayout android:id="@+id/listsList" android:layout_width="fill_parent" android:layout_height="445dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true"> <ListView android:id="@+id/lists" android:layout_width="fill_parent" android:layout_height="fill_parent" android:entries="@array/entries" > </ListView> </RelativeLayout> </RelativeLayout>

    Read the article

  • Sharing a file from Android to Gmail or to Dropbox

    - by Calaf
    To share a simple text file, I started by copying verbatim from FileProvider's manual page: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.mycorp.helloworldtxtfileprovider.MainActivity" android:exported="false" android:grantUriPermissions="true" > <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/my_paths" /> </provider> <activity android:name="com.mycorp.helloworldtxtfileprovider.MainActivity" ... Then I saved a text file and used, again nearly verbatim, the code under Sending binary content. (Notice that this applies more accurately in this case than "Sending text content" since we are sending a file, which happens to be a text file, rather than just a string of text.) For the convenience of duplication on your side, and since the code is in any case so brief, I'm including it here in full. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String filename = "hellow.txt"; String fileContents = "Hello, World!\n"; byte[] bytes = fileContents.getBytes(); FileOutputStream fos = null; try { fos = this.openFileOutput(filename, MODE_PRIVATE); fos.write(bytes); } catch (IOException e) { e.printStackTrace(); } finally { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } File file = new File(filename); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); shareIntent.setType("application/txt"); startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); file.delete(); } } Aside from adding a value for send_to in res/values/strings.xml, the only other change I did to the generic Hello, World that Eclipse creates is to add the following in res/xml/my_paths.xml (as described on the page previously referenced. <paths xmlns:android="http://schemas.android.com/apk/res/android"> <Files-path name="files" path="." /> </paths> This code runs fine. It shows a list of intent recipients. But sending the text file to either Dropbox or to Gmail fails. Dropbox sends the notification "Uploading to Dropbox" followed by "Upload failed: my_file.txt". After "sending message.." Gmail sends "Couldn't send attachment". What is wrong?

    Read the article

  • Sqlite Database LEAK FOUND exception in android?

    - by androidbase
    hi all, i am getting this exception in database Leak Found my LOGCAT Shows this: 02-17 17:20:37.857: INFO/ActivityManager(58): Starting activity: Intent { cmp=com.example.brown/.Bru_Bears_Womens_View (has extras) } 02-17 17:20:38.477: DEBUG/dalvikvm(434): GC freed 1086 objects / 63888 bytes in 119ms 02-17 17:20:38.556: ERROR/Database(434): Leak found 02-17 17:20:38.556: ERROR/Database(434): java.lang.IllegalStateException: /data/data/com.example.brown/databases/BRUNEWS_DB_01.db SQLiteDatabase created and never closed 02-17 17:20:38.556: ERROR/Database(434): at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1694) 02-17 17:20:38.556: ERROR/Database(434): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:738) 02-17 17:20:38.556: ERROR/Database(434): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:760) 02-17 17:20:38.556: ERROR/Database(434): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:753) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:473) 02-17 17:20:38.556: ERROR/Database(434): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193) 02-17 17:20:38.556: ERROR/Database(434): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98) 02-17 17:20:38.556: ERROR/Database(434): at com.example.brown.Brown_Splash.onCreate(Brown_Splash.java:52) 02-17 17:20:38.556: ERROR/Database(434): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 02-17 17:20:38.556: ERROR/Database(434): at android.os.Handler.dispatchMessage(Handler.java:99) 02-17 17:20:38.556: ERROR/Database(434): at android.os.Looper.loop(Looper.java:123) 02-17 17:20:38.556: ERROR/Database(434): at android.app.ActivityThread.main(ActivityThread.java:4363) 02-17 17:20:38.556: ERROR/Database(434): at java.lang.reflect.Method.invokeNative(Native Method) 02-17 17:20:38.556: ERROR/Database(434): at java.lang.reflect.Method.invoke(Method.java:521) 02-17 17:20:38.556: ERROR/Database(434): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 02-17 17:20:38.556: ERROR/Database(434): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 02-17 17:20:38.556: ERROR/Database(434): at dalvik.system.NativeStart.main(Native Method) how can i solve it??? thanks in advance...

    Read the article

  • why does the gingerbread emulator orientation gets stuck in apps?

    - by tabjsina
    At first I thought this was a problem with my app, but it seems to be happening in any app (though interestingly, not the home screen) in the gingerbread emulator. To replicate my issue, open eclipse and fire up the android emulator for gingerbread (I'm using the "Google APIs - API Level 9" as my target) So the procedure to duplicate once the emulator loads is press LCtrl-F11 to shift orientation to landscape, then again to switch to portrait Result: In the homescreen: The view rotates to landscape, and then back to portrait, as expected In any app (i've tried browser, calculator, maps, and the app i'm currently working on): the view rotates to landscape, and then nothing, it stays in landscape even the emulator is displaying the phone in landscape mode (see below) http://i54.tinypic.com/2ake06v.jpg Has anyone else had this issue, or have I installed the emulator in some incorrect way - this hasn't been an issue with any of the previous emulators

    Read the article

  • Android ListView appears empty, but contains objects

    - by Lethjakman
    I'm having a really odd problem with my android listview. The listview is inside of a fragment, everything's compiling and I'm no longer getting a nullpointer error, but the listview is appearing empty. Even though it's appearing empty, the log is stating that the listview has 385 objects. I can't figure out why it's empty. I do get a blue fragment, and the listview is populated. Any ideas? How I set the adapter: ActivePackages = getList(); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout mContainer = (LinearLayout) inflater.inflate(R.layout.tab_frag1_layout, null); ListView activeList = (ListView) mContainer.findViewById(R.id.activelist); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, ActivePackages); Log.i("valueof activeList",String.valueOf(activeList.getCount())); //returns 0 activeList.setAdapter(adapter); adapter.notifyDataSetChanged(); Log.i("valueof activeList",String.valueOf(activeList.getCount())); //returns 385. This is the xml for the fragment: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/activelist" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0073fd"> </ListView> </LinearLayout>

    Read the article

  • Android, FragmentActivity and prevent Swipe

    - by FIG-GHD742
    I use android.support.v4.app.FragmentActivity for create a app with multi fragment/panels that can be access by drag/swipe between different part of the app. In one of my fragment I has a zoomable view and my problem is in case I is on the zoomable view I will prevent the use for drag/swipe to a other fragment. I has try to hack into android.support.v4.view.ViewPager for get the action from on Touch event but not work. I has try all of this case but not work: (All code is a a part of subclass to android.support.v4.view.ViewPager) Case 1: // Not working @Override protected void onPageScrolled(int position, float offset, int offsetPixels) { if (isPreventDrag()) { super.onPageScrolled(position, 1, 0); } else { super.onPageScrolled(position, offset, offsetPixels); } } Case 2: // Work but stop all event include the event to the target image view. @Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastX = ev.getX(); // float lockScroll = false; return super.onInterceptTouchEvent(ev); case MotionEvent.ACTION_MOVE: this.lockScroll = this.isPreventDrag(); break; } if (lockScroll) { ev.setLocation(lastX, ev.getY()); return super.onInterceptTouchEvent(ev); } else { return super.onInterceptTouchEvent(ev); } } Case 3: // Work good, but by some unknown error I can drag the screen // some pixels before this stop the event. @Override public boolean onTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return true; } else { return super.onTouchEvent(ev); } } I want a easy way to deactivate stop or deactivate if the use is allow to switch to a other Fragment. Here is a working code for me, I don't know what error I do before. // This work for me, @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (this.isPreventDrag()) { return false; } else { return super.onInterceptTouchEvent(ev); } }

    Read the article

  • Android App to call a number on button click

    - by FosterZ
    hey guys this is my 1st android app(learning), so i want to call a number given in the textbox but i'm getting error as "The application 'xyz'(process com.adroid) has stoped unexpectedly".. following the code i have done so far... where m doing wrong ?? EditText txtPhn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button callButton = (Button)findViewById(R.id.btnCall); txtPhn = (EditText)findViewById(R.id.txtPhnNumber); callButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+txtPhn.getText().toString())); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("Calling a Phone Number", "Call failed", activityException); } } }); } EDITED LogCat 03-09 11:23:25.874: ERROR/AndroidRuntime(370): FATAL EXCEPTION: main 03-09 11:23:25.874: ERROR/AndroidRuntime(370): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx flg=0x10000000 cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{40738d70 370:org.krish.android/10034} (pid=370, uid=10034) requires android.permission.CALL_PHONE 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.os.Parcel.readException(Parcel.java:1322) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.os.Parcel.readException(Parcel.java:1276) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1351) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.app.Activity.startActivityForResult(Activity.java:2827) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.app.Activity.startActivity(Activity.java:2933) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at org.krish.android.caller$1.onClick(caller.java:29) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.view.View.performClick(View.java:2485) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.view.View$PerformClick.run(View.java:9080) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.os.Handler.handleCallback(Handler.java:587) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.os.Handler.dispatchMessage(Handler.java:92) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.os.Looper.loop(Looper.java:123) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at java.lang.reflect.Method.invokeNative(Native Method) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at java.lang.reflect.Method.invoke(Method.java:507) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-09 11:23:25.874: ERROR/AndroidRuntime(370): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • Recording a screencast of an Android app using the emulator

    - by hgpc
    Unlike the iPhone simulator, the Android emulator doesn't look like an Android device. If you have to create a screencast or promotional video of your Android application, the default skin of the emulator is no good. Is there any way to configure the emulator to look like an Android device? If you have dealt with this already, what other things do you recommend taking into account to record an emulator screencast? Not a programming question per se, but an useful question for Android developers.

    Read the article

  • Unable to start Android emulator > 1.5

    - by Cicatrice
    Hi ! I got this trace when I tried to launch android 1.6 or 2.1. Android 1.5 is working fine. I tried to reinstall each SDK, but there is no way to get it working. I created those AVD with Eclipse plugin. geo@geo-laptop:~> android/android-sdk-linux_86/tools/emulator -avd a16 *** glibc detected *** android/android-sdk-linux_86/tools/emulator: free(): invalid pointer: 0x45454545 *** ======= Backtrace: ========= /lib/libc.so.6(+0x6df7b)[0xb748cf7b] /lib/libc.so.6(cfree+0xd9)[0xb7491ac9] android/android-sdk-linux_86/tools/emulator[0x80db20c] android/android-sdk-linux_86/tools/emulator[0x840eb38] ======= Memory map: ======== 08048000-08246000 r-xp 00000000 08:06 5693701 /home/geo/android/android-sdk-linux_86/tools/emulator 08246000-08249000 rw-p 001fd000 08:06 5693701 /home/geo/android/android-sdk-linux_86/tools/emulator 08249000-08445000 rw-p 00000000 00:00 0 08445000-08447000 rwxp 00000000 00:00 0 08447000-0874c000 rw-p 00000000 00:00 0 [heap] ad8e9000-ada86000 rw-s 00000000 00:04 85229580 /SYSV00000000 (deleted) ada86000-adced000 rw-p 00000000 00:00 0 adced000-add0d000 rw-s 00000000 00:04 84770825 /SYSV0056a4d6 (deleted) add0d000-adde4000 r-xp 00000000 08:05 22591 /usr/lib/libasound.so.2.0.0 adde4000-adde5000 ---p 000d7000 08:05 22591 /usr/lib/libasound.so.2.0.0 adde5000-adde8000 r--p 000d7000 08:05 22591 /usr/lib/libasound.so.2.0.0 adde8000-adde9000 rw-p 000da000 08:05 22591 /usr/lib/libasound.so.2.0.0 adde9000-ade09000 rw-s 00000000 00:05 3268 /dev/snd/pcmC0D0p ade09000-b3e0b000 rw-p 00000000 00:00 0 b3e0b000-b3e0c000 ---p 00000000 00:00 0 b3e0c000-b55cd000 rw-p 00000000 00:00 0 b55cd000-b6dcd000 rwxp 00000000 00:00 0 b6dcd000-b6ea3000 rw-p 00000000 00:00 0 b6ea4000-b7205000 rw-p 00000000 00:00 0 b7205000-b7209000 r-xp 00000000 08:05 22491 /usr/lib/libXfixes.so.3.1.0 b7209000-b720a000 r--p 00003000 08:05 22491 /usr/lib/libXfixes.so.3.1.0 b720a000-b720b000 rw-p 00004000 08:05 22491 /usr/lib/libXfixes.so.3.1.0 b7212000-b7222000 rw-s 00000000 00:05 3269 /dev/snd/pcmC0D0c b7222000-b7226000 r-xp 00000000 08:05 22588 /usr/lib/alsa-lib/libasound_module_rate_speexrate.so b7226000-b7227000 r--p 00003000 08:05 22588 /usr/lib/alsa-lib/libasound_module_rate_speexrate.so b7227000-b7228000 rw-p 00004000 08:05 22588 /usr/lib/alsa-lib/libasound_module_rate_speexrate.so b7228000-b7229000 rw-s 81000000 00:05 3268 /dev/snd/pcmC0D0p b7229000-b722a000 r--s 80000000 00:05 3268 /dev/snd/pcmC0D0p b722a000-b722b000 rw-s 00000000 00:04 84738056 /SYSV0056a4d5 (deleted) b722b000-b7276000 r--p 00000000 08:05 85242 /var/cache/libx11/compose/l4_024_313cb605_00280cc0 b7276000-b72b5000 r--p 00000000 08:05 20724 /usr/lib/locale/en_US.utf8/LC_CTYPE b72b5000-b73d2000 r--p 00000000 08:05 101088 /usr/lib/locale/en_US.utf8/LC_COLLATE b73d2000-b73d9000 r-xp 00000000 08:05 22991 /usr/lib/libXrandr.so.2.2.0 b73d9000-b73da000 r--p 00006000 08:05 22991 /usr/lib/libXrandr.so.2.2.0 b73da000-b73db000 rw-p 00007000 08:05 22991 /usr/lib/libXrandr.so.2.2.0 b73db000-b73e4000 r-xp 00000000 08:05 4146 /usr/lib/libXrender.so.1.3.0 b73e4000-b73e5000 r--p 00008000 08:05 4146 /usr/lib/libXrender.so.1.3.0 b73e5000-b73e6000 rw-p 00009000 08:05 4146 /usr/lib/libXrender.so.1.3.0 b73e6000-b73f7000 r-xp 00000000 08:05 3705 /usr/lib/libXext.so.6.4.0 b73f7000-b73f8000 r--p 00010000 08:05 3705 /usr/lib/libXext.so.6.4.0 b73f8000-b73f9000 rw-p 00011000 08:05 3705 /usr/lib/libXext.so.6.4.0 b73f9000-b73fa000 rw-p 00000000 00:00 0 b73fa000-b73fc000 r-xp 00000000 08:05 8573 /usr/lib/libXau.so.6.0.0 b73fc000-b73fd000 r--p 00001000 08:05 8573 /usr/lib/libXau.so.6.0.0 b73fd000-b73fe000 rw-p 00002000 08:05 8573 /usr/lib/libXau.so.6.0.0 b73fe000-b73ff000 rw-p 00000000 00:00 0 b73ff000-b741d000 r-xp 00000000 08:05 3862 /usr/lib/libxcb.so.1.1.0 b741d000-b741e000 r--p 0001d000 08:05 3862 /usr/lib/libxcb.so.1.1.0 b741e000-b741f000 rw-p 0001e000 08:05 3862 /usr/lib/libxcb.so.1.1.0 b741f000-b7583000 r-xp 00000000 08:05 39690 /lib/libc-2.11.1.so b7583000-b7584000 ---p 00164000 08:05 39690 /lib/libc-2.11.1.so b7584000-b7586000 r--p 00164000 08:05 39690 /lib/libc-2.11.1.so b7586000-b7587000 rw-p 00166000 08:05 39690 /lib/libc-2.11.1.so b7587000-b758a000 rw-p 00000000 00:00 0 b758a000-b75a6000 r-xp 00000000 08:05 11519 /lib/libgcc_s.so.1 b75a6000-b75a7000 r--p 0001b000 08:05 11519 /lib/libgcc_s.so.1 b75a7000-b75a8000 rw-p 0001c000 08:05 11519 /lib/libgcc_s.so.1 b75a8000-b768b000 r-xp 00000000 08:05 85419 /usr/lib/libstdc++.so.6.0.14 b768b000-b768c000 ---p 000e3000 08:05 85419 /usr/lib/libstdc++.so.6.0.14 b768c000-b7690000 r--p 000e3000 08:05 85419 /usr/lib/libstdc++.so.6.0.14 b7690000-b7691000 rw-p 000e7000 08:05 85419 /usr/lib/libstdc++.so.6.0.14 b7691000-b7698000 rw-p 00000000 00:00 0 b7698000-b76c0000 r-xp 00000000 08:05 39698 /lib/libm-2.11.1.so b76c0000-b76c1000 r--p 00027000 08:05 39698 /lib/libm-2.11.1.so b76c1000-b76c2000 rw-p 00028000 08:05 39698 /lib/libm-2.11.1.so b76c2000-b76d9000 r-xp 00000000 08:05 39716 /lib/libpthread-2.11.1.so b76d9000-b76da000 r--p 00016000 08:05 39716 /lib/libpthread-2.11.1.so b76da000-b76db000 rw-p 00017000 08:05 39716 /lib/libpthread-2.11.1.so b76db000-b76de000 rw-p 00000000 00:00 0 b76de000-b76e1000 r-xp 00000000 08:05 39696 /lib/libdl-2.11.1.so b76e1000-b76e2000 r--p 00002000 08:05 39696 /lib/libdl-2.11.1.so b76e2000-b76e3000 rw-p 00003000 08:05 39696 /lib/libdl-2.11.1.so b76e3000-b76eb000 r-xp 00000000 08:05 39720 /lib/librt-2.11.1.so b76eb000-b76ec000 r--p 00007000 08:05 39720 /lib/librt-2.11.1.so b76ec000-b76ed000 rw-p 00008000 08:05 39720 /lib/librt-2.11.1.so b76ed000-b76ef000 r-xp 00000000 08:05 39725 /lib/libutil-2.11.1.so b76ef000-b76f0000 r--p 00001000 08:05 39725 /lib/libutil-2.11.1.so b76f0000-b76f1000 rw-p 00002000 08:05 39725 /lib/libutil-2.11.1.so b76f1000-b7828000 r-xp 00000000 08:05 4550 /usr/lib/libX11.so.6.3.0 b7828000-b7829000 r--p 00136000 08:05 4550 /usr/lib/libX11.so.6.3.0 b7829000-b782c000 rw-p 00137000 08:05 4550 /usr/lib/libX11.so.6.3.0 b782c000-b782d000 rw-s 81000000 00:05 3269 /dev/snd/pcmC0D0c b782d000-b782e000 r--s 80000000 00:05 3269 /dev/snd/pcmC0D0c b782e000-b782f000 rw-s 00000000 00:04 82771979 /SYSV0056a4d7 (deleted) b782f000-b7839000 r-xp 00000000 08:05 22208 /usr/lib/libXcursor.so.1.0.2 b7839000-b783a000 r--p 00009000 08:05 22208 /usr/lib/libXcursor.so.1.0.2 b783a000-b783b000 rw-p 0000a000 08:05 22208 /usr/lib/libXcursor.so.1.0.2 b783b000-b783c000 r--p 00000000 08:05 20194 /usr/lib/locale/en_US.utf8/LC_NUMERIC b783c000-b783d000 r--p 00000000 08:05 100190 /usr/lib/locale/en_US.utf8/LC_TIME b783d000-b783e000 r--p 00000000 08:05 100189 /usr/lib/locale/en_US.utf8/LC_MONETARY[1] 24082 abort android/android-sdk-linux_86/tools/emulator -avd a16

    Read the article

  • java.lang.RuntimeException: Unable to start activity ComponentInfo cannot be cast to android.widget.ZoomControls

    - by Hwl
    I'm new to android development, hope you all can help me. I got this androidVNC viewer source code from internet. When i'm running the androidVNC application in the emulator, it will exit automatically then i get following errors in LogCat. Can anyone one help me? Thanks. FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{android.androidVNC/android.androidVNC.VncCanvasActivity}: java.lang.ClassCastException: com.antlersoft.android.zoomer.ZoomControls cannot be cast to android.widget.ZoomControls at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4340) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: com.antlersoft.android.zoomer.ZoomControls cannot be cast to android.widget.ZoomControls at android.androidVNC.VncCanvasActivity.onCreate(VncCanvasActivity.java:585) at android.app.Activity.performCreate(Activity.java:4465) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919) ... 11 more This is the ZoomControls java file: package com.antlersoft.android.zoomer; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.animation.AlphaAnimation; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ZoomButton; public class ZoomControls extends LinearLayout { private final ZoomButton mZoomIn; private final ZoomButton mZoomOut; private final ImageButton mZoomKeyboard; public ZoomControls(Context context) { this(context, null); } public ZoomControls(Context context, AttributeSet attrs) { super(context, attrs); setFocusable(false); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.zoom_controls, this, // we are the parent true); mZoomIn = (ZoomButton) findViewById(R.id.zoomIn); mZoomOut = (ZoomButton) findViewById(R.id.zoomOut); mZoomKeyboard = (ImageButton) findViewById(R.id.zoomKeys); } public void setOnZoomInClickListener(OnClickListener listener) { mZoomIn.setOnClickListener(listener); } public void setOnZoomOutClickListener(OnClickListener listener) { mZoomOut.setOnClickListener(listener); } public void setOnZoomKeyboardClickListener(OnClickListener listener) { mZoomKeyboard.setOnClickListener(listener); } /* * Sets how fast you get zoom events when the user holds down the * zoom in/out buttons. */ public void setZoomSpeed(long speed) { mZoomIn.setZoomSpeed(speed); mZoomOut.setZoomSpeed(speed); } @Override public boolean onTouchEvent(MotionEvent event) { /* Consume all touch events so they don't get dispatched to the view * beneath this view. */ return true; } public void show() { fade(View.VISIBLE, 0.0f, 1.0f); } public void hide() { fade(View.GONE, 1.0f, 0.0f); } private void fade(int visibility, float startAlpha, float endAlpha) { AlphaAnimation anim = new AlphaAnimation(startAlpha, endAlpha); anim.setDuration(500); startAnimation(anim); setVisibility(visibility); } public void setIsZoomInEnabled(boolean isEnabled) { mZoomIn.setEnabled(isEnabled); } public void setIsZoomOutEnabled(boolean isEnabled) { mZoomOut.setEnabled(isEnabled); } @Override public boolean hasFocus() { return mZoomIn.hasFocus() || mZoomOut.hasFocus(); } } This is the zoom_controls XML file: <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ZoomButton android:id="@+id/zoomOut" android:background="@drawable/btn_zoom_down" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageButton android:id="@+id/zoomKeys" android:background="@android:drawable/ic_dialog_dialer" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ZoomButton android:id="@+id/zoomIn" android:background="@drawable/btn_zoom_up" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </merge>

    Read the article

  • Unable to stretch TableLayout to screen width

    - by Rendrik
    I've tried unsuccessfully for quite a few hours now to simply get a TableLayout to scale to the full screen. I've tried stretchColumns, shrinkColumns, (specifying the column index or using *) you name it. It's almost as if the parent element (TableLayout) is completely ignoring 'android:layout_width="fill_parent"'. I've read through similar questions here, though they haven't solved it for me. The XML below has 3 rows, and the table always shrink wraps to the size of the content. Apparently I'm too new to post pictures(?) Here is the XML rendered into the project i'm working on. http://www.dashiva.com/images/Capture.png What am I missing here, it's quite frustrating! <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*"> <TableRow> <TextView android:id="@+id/AmountText" android:text="@string/general_amount" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardText" android:text="@string/general_card" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="@string/general_date" android:id="@+id/DateText" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/ErrorText" android:text="@string/general_error" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <TextView android:text="Amount here..." android:id="@+id/AmountNum" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardNum" android:text="Num here..." android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="date here..." android:id="@+id/DateDate" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="Code here..." android:id="@+id/ErrorCode" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <ImageView android:id="@+id/cc_image" android:src="@drawable/mastercard" android:background="@drawable/row_bg2" android:layout_gravity="center" android:layout_weight="1"></ImageView> <TextView android:id="@+id/ResponseText" android:layout_span="4" android:text="Response text here..." android:textSize="18dip" android:layout_weight="1"></TextView> </TableRow> <ImageView android:layout_gravity="center_vertical" android:background="@drawable/gradient_bg" android:layout_height="3dip" android:layout_width="fill_parent"></ImageView> </TableLayout>

    Read the article

  • android searchable not opening

    - by ng93
    Hi im trying to use a searchable activity in my application but when the search button is pressed nothing happens AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.test" android:versionCode="1" android:versionName="1.0.0" android:configChanges="keyboardHidden|orientation"> <uses-sdk android:minSdkVersion="7"/> <application android:icon="@drawable/icon" android:label="Test"> <activity android:name=".Test" android:label="Test" android:debuggable="true" android:theme="@android:style/Theme.NoTitleBar" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".Searchable"> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/> </activity> <meta-data android:name="android.app.default_searchable" android:value=".Searchable"/> </application> </manifest> Searchable.xml (res/xml/searchable.xml) <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Search" android:hint="Perform Search"> </searchable> Searchable.java (src/com/test/test/Searchable.java) package com.test.test; import android.app.Activity; import android.app.SearchManager; import android.content.Intent; import android.os.Bundle; public class Searchable extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); handleIntent(getIntent()); } @Override protected void onNewIntent(Intent intent) { setIntent(intent); handleIntent(intent); } private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); } } } TIA, ng93

    Read the article

  • I can't understand this issue java.lang.IndexOutOfBoundsException.

    - by praveenb
    I've strange issue, that My application is working fine on some devices, But its crashing one of the client device(on Galaxy Nexus 4.1.1 v) at app starting screen. I get this stack trace from ACRA report. java.lang.IndexOutOfBoundsException at android.graphics.Paint.getTextRunAdvances(Paint.java:1731) at android.graphics.Paint.getTextRunAdvances(Paint.java:1704) at android.text.MeasuredText.addStyleRun(MeasuredText.java:164) at android.text.MeasuredText.addStyleRun(MeasuredText.java:204) at android.text.StaticLayout.generate(StaticLayout.java:281) at android.text.DynamicLayout.reflow(DynamicLayout.java:284) at android.text.DynamicLayout.(DynamicLayout.java:170) at android.widget.TextView.makeSingleLayout(TextView.java:5843) at android.widget.TextView.makeNewLayout(TextView.java:5741) at android.widget.TextView.onMeasure(TextView.java:6098) at android.view.View.measure(View.java:15172) at android.widget.LinearLayout.measureVertical(LinearLayout.java:833) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148) at android.view.View.measure(View.java:15172) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Im seeing above stack trace. I'm unable to understand the issue. Please help me on tacking the issue. Thank you.

    Read the article

  • Newbie question: How do you layout an icon, 2 text lines and a button?

    - by Keith Barrows
    I am trying to extend a sample I found at http://developer.android.com/resources/articles/layout-tricks-efficiency.html. I am a brand new MonoDroid developer, just installed it yesterday, and trying to jump right into UI design and so far it is not clicking for me completely. I have this main.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:padding="6dip"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_marginRight="6dip" android:src="@drawable/icon" /> <TextView android:id="@+id/secondLine" android:layout_width="200dip" android:layout_height="26dip" android:layout_toRightOf="@id/icon" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:singleLine="true" android:ellipsize="marquee" android:text="Second line which is a long line of text and needs to scroll" /> <TextView android:id="@+id/firstLine" android:layout_width="200dip" android:layout_height="wrap_content" android:layout_toRightOf="@id/icon" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_above="@id/secondLine" android:layout_alignWithParentIfMissing="true" android:singleLine="true" android:ellipsize="marquee" android:gravity="center_vertical" android:text="First line" /> <Button android:id="@+id/logonButton" android:layout_width="50dip" android:layout_height="wrap_content" android:layout_toRightOf="@id/secondLine" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:gravity="center_vertical" android:text="Login" /> /> </RelativeLayout> What I am trying to do is have an icon on the left, 2 lines of text stacked in the middle and a button on the right. When I run this in my emulator I am seeing: The second line is not scrolling. The button does not show up. Is there by any chance a simple WYSIWYG editor for layout? Or is there an app to give me a quick view of my layout XML? Something like FireBug in FireFox would be fine. Barring the slim chance there are UI helpers for Droid, what am I doing wrong? :)

    Read the article

  • My google map android app keeps crashing

    - by Manny264
    I have followed about two tutorials from vogella and some other tutorial that looked similar...very similar but to no avail. I load the app on my nexus 7 and it just crashes "Unfortunately MyMapView has stopped working" on launch.This is the manifest: ` <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <uses-library android:name="com.google.android.maps" /> <activity android:name="com.macmozart.mymapview.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBZ1Bt7rjB863Jy-B05zls6k8XZsBGQ6-4" /> </application> ` Followed by my main layout: <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /> and finally my java class: package com.macmozart.mymapview; import android.app.Activity; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.maps.*; public class MainActivity extends Activity { static final LatLng HAMBURG = new LatLng(53.558, 9.927); static final LatLng KIEL = new LatLng(53.551, 9.993); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); if (map != null) { Marker hamburg = map.addMarker(new MarkerOptions() .position(HAMBURG).title("Hamburg")); Marker kiel = map.addMarker(new MarkerOptions() .position(KIEL) .title("Kiel") .snippet("Kiel is cool") .icon(BitmapDescriptorFactory .fromResource(R.drawable.ic_launcher))); map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15)); // Zoom in, animating the camera. map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); } } } Any idea what im doing wrong I really need this to work

    Read the article

  • Unable to Start Activity ComponentInfo when Starting a New Activity

    - by Timtim17
    {I know there's already a whole bunch of questions like this, but I can't see any problems that related to my program.} I have an Android App that is supposed to take a name from a EditText and put it in a TextView in another activity. It previously worked, but then I wanted it to start another activity if the EditText's value was equal to "ANDROID". However, now the app crashes whenever I try to start either activity. First Activity: package net.timtim17.dev.android.fun.nametag; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText) findViewById(R.id.editText1); Button submit = (Button) findViewById(R.id.button1); submit.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { String text = et.getText().toString(); if(text.equals("ANDROID")){ Intent android = new Intent(MainActivity.this, AndroidNameTag.class); startActivity(android); }else{ Intent intent = new Intent(MainActivity.this, NameTag.class); intent.putExtra("name", text); startActivity(intent); } } }); } } NameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class NameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tag); TextView tv = (TextView) findViewById(R.id.textView2); tv.setText(getIntent().getExtras().getString("name")); } } AndroidNameTag Activity: package net.timtim17.dev.android.fun.nametag; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.ImageView; public class AndroidNameTag extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_android); ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setBackgroundResource(R.anim.animation); AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); } } LogCat Error: 10-26 11:26:35.602: E/AndroidRuntime(2900): FATAL EXCEPTION: main 10-26 11:26:35.602: E/AndroidRuntime(2900): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.timtim17.dev.android.fun.nametag/net.timtim17.dev.android.fun.nametag.NameTag}: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.access$600(ActivityThread.java:141) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Handler.dispatchMessage(Handler.java:99) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.os.Looper.loop(Looper.java:137) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.main(ActivityThread.java:5103) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invokeNative(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): at java.lang.reflect.Method.invoke(Method.java:525) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 10-26 11:26:35.602: E/AndroidRuntime(2900): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-26 11:26:35.602: E/AndroidRuntime(2900): at dalvik.system.NativeStart.main(Native Method) 10-26 11:26:35.602: E/AndroidRuntime(2900): Caused by: java.lang.NullPointerException 10-26 11:26:35.602: E/AndroidRuntime(2900): at net.timtim17.dev.android.fun.nametag.NameTag.onCreate(NameTag.java:15) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Activity.performCreate(Activity.java:5133) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-26 11:26:35.602: E/AndroidRuntime(2900): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 10-26 11:26:35.602: E/AndroidRuntime(2900): ... 11 more MainActivity Layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="16dp" android:text="@string/main_text" android:textAppearance="?android:attr/textAppearanceMedium" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="14dp" android:text="@string/submit_button" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignTop="@+id/button1" android:ems="10" android:inputType="textPersonName" > <requestFocus /> </EditText>

    Read the article

  • Android: Adding extended GLSurfaceView to a Layout don't show 3d stuff

    - by Santiago
    I make a game extending the class GLSurfaceView, if I apply SetContentView directly to that class, the 3d stuff and input works great. Now I want to show some items over 3d stuff, so I create a XML with a layout and some objects, and I try to add my class manually to the layout. I'm not getting errors but the 3d stuff is not shown but I can view the objects from XML layout. source: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); layout = (RelativeLayout) inflater.inflate(R.layout.testlayout, null); //Create an Instance with this Activity my3dstuff = new myGLSurfaceViewClass(this); layout.addView(my3dstuff,4); setContentView(R.layout.testlayout); } And testlayout have: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Pantalla"> <ImageView android:id="@+id/zoom_less" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/zoom_less"></ImageView> <ImageView android:id="@+id/zoom_more" android:layout_width="wrap_content" android:src="@drawable/zoom_more" android:layout_height="wrap_content" android:layout_alignParentRight="true"></ImageView> <ImageView android:id="@+id/zoom_normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/zoom_normal" android:layout_centerHorizontal="true"></ImageView> <ImageView android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/stop" android:layout_centerInParent="true" android:layout_alignParentBottom="true"></ImageView> </RelativeLayout> I also tried to add my class to XML but the Activity hangs up. <com.mygame.myGLSurfaceViewClass android:id="@+id/my3dstuff" android:layout_width="fill_parent" android:layout_height="fill_parent"></com.mygame.myGLSurfaceViewClass> and this don't works: <View class="com.mygame.myGLSurfaceViewClass" android:id="@+id/my3dstuff" android:layout_width="fill_parent" android:layout_height="fill_parent"></View> Any Idea? Thanks

    Read the article

  • Start TabActivity from ListActivity (which is content of parent TabActivity) in Android

    - by barmaleikin
    Hi guys, I have problems with switching between activities. I have two TabActivities (A and B), each of of tab activity has 4 tabs with ListActivity. I am trying to show B activity onListItemClick. Code on click is: Intent intent = new Intent(getApplicationContext(), TabBActivity.class); startActivity(intent); My manifest file is following: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true"> <activity android:name=".SplashScreen" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TabAActivity"> <intent-filter> <action android:name="com.TabAActivity" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".TabAListActivityA" android:label="AA"/> <activity android:name=".TabAListActivityB" android:label="AB"/> <activity android:name=".TabAListActivityC" android:label="AC"/> <activity android:name=".TabBActivity" android:label="B"/> <activity android:name=".TabAListBctivityA" android:label="BA"/> <activity android:name=".TabAListBctivityB" android:label="BB"/> <activity android:name=".TabAListBctivityC" android:label="BC"/> </application> </manifest> Is my manifest correct or maybe something is wrong with code? I would appreciate any help on this topic.

    Read the article

  • java.lang.NoClassDefFoundError at Runtime Android Widget

    - by pxrb66
    I have a problem during runtime of my Android widget with Android 2.3.3 and older. When i install my widget on the screen, this error is printed : 11-03 10:26:31.127: E/AndroidRuntime(404): FATAL EXCEPTION: main 11-03 10:26:31.127: E/AndroidRuntime(404): java.lang.NoClassDefFoundError: com.app.myapp.StackWidgetService 11-03 10:26:31.127: E/AndroidRuntime(404): at com.app.myapp.StackWidgetProvider.onUpdate(StackWidgetProvider.java:229) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java:61) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.app.mobideals.StackWidgetProvider.onReceive(StackWidgetProvider.java:216) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1794) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.access$2400(ActivityThread.java:117) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.os.Handler.dispatchMessage(Handler.java:99) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.os.Looper.loop(Looper.java:123) 11-03 10:26:31.127: E/AndroidRuntime(404): at android.app.ActivityThread.main(ActivityThread.java:3683) 11-03 10:26:31.127: E/AndroidRuntime(404): at java.lang.reflect.Method.invokeNative(Native Method) 11-03 10:26:31.127: E/AndroidRuntime(404): at java.lang.reflect.Method.invoke(Method.java:507) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 11-03 10:26:31.127: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 11-03 10:26:31.127: E/AndroidRuntime(404): at dalvik.system.NativeStart.main(Native Method) The problem is due to the fact that the compilator don't arrive to perform the link to the StackWidgetService class at this line in onUpdate method of StackWidgetProvider class : public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // update each of the widgets with the remote adapter for (int i = 0; i < appWidgetIds.length; ++i) { // Here we setup the intent which points to the StackViewService which will // provide the views for this collection. Intent intent = new Intent(context, StackWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); The widget works well with other version of Android like 3.0, 4.0 etc... Please help me :)

    Read the article

  • Android local search

    - by Aleksander O
    Hi! I'm trying to implement a local search in my activity. I've added an appropriate intent filter and metadata tag to manifest file but if I click Search button it invokes standard android search box. What's my problem? Manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nixsolutions.invertigation.android.dataprovider" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <provider android:name="NoteProvider" android:authorities="com.nixsolutions.investigation.android.NoteProvider"> </provider> <activity android:name="NotesList"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> </activity> </application> <uses-sdk android:minSdkVersion="7" /> </manifest> searchable.xml: <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Custom search" android:hint="Custom hint" android:searchMode="showSearchLabelAsBadge" />

    Read the article

  • Nested Linear layout only shows first view after being set from gone to visible in Android

    - by Adam
    Hi guys, I am developing an Android app but I'm still pretty new. I want to have a button, and when you push that button, a few TextViews and Buttons will appear. So I have a main linear layout, and then another linear layout nested inside containing the things I want hidden. I have the nested linear layout set to android:visibility="gone". The problem I am having is that it only shows the first item inside the hidden linear layout instead of all of them. The way I try to make it appear is vgAddView = (ViewGroup)findViewById(R.id.add_details); btnAche.setOnClickListener(new OnClickListener(){ public void onClick(View v){ vgAddView.setVisibility(0); } }); My XML file is this <?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" > <Button android:text="@string/but_stomach_ache" android:id="@+id/but_stomach_ache" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> <Button android:text="@string/but_food" android:id="@+id/but_food" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/add_details" android:visibility="gone"> <TextView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/when_happen"> </TextView> <Button android:text="@string/happen_now" android:id="@+id/happen_now" android:layout_width="fill_parent" android:layout_height="wrap_content"> </Button> </LinearLayout> </LinearLayout>

    Read the article

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