Search Results

Search found 39486 results on 1580 pages for 'ubuntu for android'.

Page 11/1580 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Android ListView TextSize

    - by zaid
    my listview.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/zaid.quotes.dlama"> <ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginBottom="50dp" android:paddingTop="50dp"></ListView> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Back" android:layout_alignParentBottom="true" android:text="Go Back"></Button> <LinearLayout android:layout_width="wrap_content" android:id="@+id/LinearLayout01" android:layout_height="wrap_content" android:layout_alignParentTop="true"> <com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" android:layout_alignParentTop="true" /> </LinearLayout> </RelativeLayout> the current size of the text in the listview is large. and i cant seem to figure out how to change the text size.

    Read the article

  • Android 2.2 AVD: no Quick Search Box?

    - by Felix
    I have recently updated my Android SDK to include support for Android 2.2 (API level 8). The app that I'm building integrates with the Quick Search Box (QSB) home screen widget, which I can't seem to find in this version (using both vanilla 2.2 and the Google APIs version). I was kind of excited when they announced that they have improved its functionality, but it seems there's no way for me to observe it. Is this normal? Are others experiencing the same issue? Or is this somehow related to my setup (running Archlinux and installed the Android SDK from the repositories).

    Read the article

  • How to make an Android UI with images from a designer delivered as layers

    - by Not Me
    I hired a designer to help me redesign the UI for my Android app. For each Activity he gave me an image for the background, which includes any static content like fancy frames for text content; plus images for the buttons, which must fit in to the background image in exact places, to fit into the frames in the background image. However, since Android devices have different screen sizes and aspect ratios, it's easy to fit the background image by itself with android:scaleType="centerInside", but how can I get all the other images to fit in with background exactly, to the pixel? If they didn't have to fit in with the background, I would just set the exact width and height for each ImageButton, but depending on how the background scales (based on the screen size and ratio) they might end up not aligned correctly. Thank you very much in advance.

    Read the article

  • marquee text view in android

    - by raqz
    i tried various combinations as answered here in SO...but i am still not able to get the text to marquee... combination 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/organizationText" android:layout_height="38px" android:gravity="center_horizontal" android:textColor="#0099CC" android:layout_gravity="center" android:textSize="08pt" android:layout_width="wrap_content" android:maxLines="1" android:ellipsize="marquee" android:fadingEdge="horizontal" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" /> </RelativeLayout> orgText.setSelected(true); orgText.setEllipsize(TruncateAt.MARQUEE); orgText.setText(organization); I tried without using setSelected but it still doesnt work. any help would be appreciated... also, this entire view is a part of Linear layout.

    Read the article

  • 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

  • Android - Problem in Edittext

    - by PM - Paresh Mayani
    Hi, I am facing trouble to set WrapText kind of facility in EditText. Problem: When i try tp enter data in EditText, it goes beyond the screen width (scrolling horizontally). Instead of it should be appear in next-line. Please suggest me what should i do ?? Please have a look at below image: I have done the below XML coding: <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="10dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:stretchColumns="1"> <TableRow android:id="@+id/TableRow02" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:text="Name:" android:id="@+id/TextView01" android:layout_width="80dp" android:layout_height="wrap_content" android:textSize="16dip"> </TextView> <EditText android:id="@+id/txtViewName" android:layout_height="wrap_content" android:layout_width="wrap_content" android:inputType="textFilter|textMultiLine|textNoSuggestions" android:scrollHorizontally="false"> </EditText> </TableRow> </TableLayout>

    Read the article

  • Android RadioButton like Behaviour

    - by monxalo
    Greetings, I'm trying to create a single-choice android control, in a horizontal layout, by making use of the RadioGroup behaviour. I can assign the drawable just fine, but i would like to position the label of each RadioButton inside the drawable, is this possible using the standard APIs? <RadioGroup android:id="@+id/switchcontainer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:checkedButton="@+id/RadioButton02" android:padding="3dip"> <RadioButton android:text="id RadioButton02" android:id="@+id/RadioButton02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@drawable/radio_button" android:paddingRight="2dip" /> <RadioButton android:text="@+id/RadioButton03" android:id="@+id/RadioButton03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@drawable/radio_button" android:paddingRight="2dip" />> </RadioGroup>

    Read the article

  • 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

  • Restoring android after ubuntu touch fails

    - by deimus
    I'm trying to restore android after playing around with ubuntu touch I follow exactly the same steps described the ubuntu's wiki page i.e. Download the factory image corresponding to your device's model and version (initial table has links). Ensure the device is connected and powered on. Extract the downloaded file and cd into the extracted directory. run adb reboot-bootloader run ./flash-all.sh (use sudo if lack of permissions on the workstation don't allow you to talk to the device). The archive is downloaded successfully, checked the sha1 checksum everything is ok. But the ./flash-all.sh fails like this sending 'bootloader' (2308 KB)... OKAY [ 0.513s] writing 'bootloader'... OKAY [ 0.292s] finished. total time: 0.805s rebooting into bootloader... OKAY [ 0.007s] finished. total time: 0.008s sending 'radio' (12288 KB)... OKAY [ 2.668s] writing 'radio'... OKAY [ 1.372s] finished. total time: 4.040s rebooting into bootloader... OKAY [ 0.009s] finished. total time: 0.009s archive does not contain 'boot.sig' archive does not contain 'recovery.sig' failed to allocate 435793780 bytes error: update package missing system.img My device is Nexus 4. Tried both 4.2.2 and 4.3 androind versions for Nexus 4 still the same. Any ideas how problem can be solved ?

    Read the article

  • ubuntu 9.04 pptp broken after a power failure

    - by kevin42
    I have a small Ubuntu 9.04 router setup as a NAT box and a PPTP server. After a power failure everything except the PPTP server still works. A windows client gets to "registering your computer on the network" but then says Error 742: The remote computer does not support the required data encryption type. I did some research and I think the problem is with the ppp_mppe module. When I try to run 'modprobe ppp_mppe' it hangs indefinitely. What would cause this hang? Any ideas how I can troubleshoot this further? Thanks for the help! UPDATE: I am still having the problem, however I have found some more information. When the first user tries to connect to pptp, the process list shows modprobe sha1 running, and one instance of modprobe ppp_mppe for each connection attempt. If I killall modprobe at this point the next connection attempt works, and everything is fine until the next reboot. I'm planning to do a clean install at some point in the future but I'd really like to get to the real cause of this.

    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

  • Installing Ubuntu One on Ubuntu 11.10 server

    - by Yaron
    I have installed "Ubuntu One" on an Ubuntu server 11.10 based on these instructions: How do I configure Ubuntu one on a 11.10 server? Everything went smooth during installation. However when I try the command: u1sdtool --start to get the server up, I get the following stack error: u1sdtool --start /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/init.py:57: GtkWarning: could not open display warnings.warn(str(e), _gtk.Warning) Unhandled Error Traceback (most recent call last): dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11 Does anyone have a clue how to solve this issue?

    Read the article

  • Clone a Hard Drive Using an Ubuntu Live CD

    - by Trevor Bekolay
    Whether you’re setting up multiple computers or doing a full backup, cloning hard drives is a common maintenance task. Don’t bother burning a new boot CD or paying for new software – you can do it easily with your Ubuntu Live CD. Not only can you do this with your Ubuntu Live CD, you can do it right out of the box – no additional software needed! The program we’ll use is called dd, and it’s included with pretty much all Linux distributions. dd is a utility used to do low-level copying – rather than working with files, it works directly on the raw data on a storage device. Note: dd gets a bad rap, because like many other Linux utilities, if misused it can be very destructive. If you’re not sure what you’re doing, you can easily wipe out an entire hard drive, in an unrecoverable way. Of course, the flip side of that is that dd is extremely powerful, and can do very complex tasks with little user effort. If you’re careful, and follow these instructions closely, you can clone your hard drive with one command. We’re going to take a small hard drive that we’ve been using and copy it to a new hard drive, which hasn’t been formatted yet. To make sure that we’re working with the right drives, we’ll open up a terminal (Applications > Accessories > Terminal) and enter in the following command sudo fdisk –l We have two small drives, /dev/sda, which has two partitions, and /dev/sdc, which is completely unformatted. We want to copy the data from /dev/sda to /dev/sdc. Note: while you can copy a smaller drive to a larger one, you can’t copy a larger drive to a smaller one with the method described below. Now the fun part: using dd. The invocation we’ll use is: sudo dd if=/dev/sda of=/dev/sdc In this case, we’re telling dd that the input file (“if”) is /dev/sda, and the output file (“of”) is /dev/sdc. If your drives are quite large, this can take some time, but in our case it took just less than a minute. If we do sudo fdisk –l again, we can see that, despite not formatting /dev/sdc at all, it now has the same partitions as /dev/sda.  Additionally, if we mount all of the partitions, we can see that all of the data on /dev/sdc is now the same as on /dev/sda. Note: you may have to restart your computer to be able to mount the newly cloned drive. And that’s it…If you exercise caution and make sure that you’re using the right drives as the input file and output file, dd isn’t anything to be scared of. Unlike other utilities, dd copies absolutely everything from one drive to another – that means that you can even recover files deleted from the original drive in the clone! Similar Articles Productive Geek Tips Reset Your Ubuntu Password Easily from the Live CDHow to Browse Without a Trace with an Ubuntu Live CDRecover Deleted Files on an NTFS Hard Drive from a Ubuntu Live CDCreate a Bootable Ubuntu 9.10 USB Flash DriveWipe, Delete, and Securely Destroy Your Hard Drive’s Data the Easy Way TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Xobni Plus for Outlook All My Movies 5.9 CloudBerry Online Backup 1.5 for Windows Home Server Snagit 10 Windows Media Player Glass Icons (icons we like) How to Forecast Weather, without Gadgets Outlook Tools, one stop tweaking for any Outlook version Zoofs, find the most popular tweeted YouTube videos Video preview of new Windows Live Essentials 21 Cursor Packs for XP, Vista & 7

    Read the article

  • Can't boot Ubuntu 12.10 32 or 64 Bit, only Ubuntu 12.04 32 Bit [closed]

    - by Alexander
    Possible Duplicate: My computer boots to a black screen, what options do I have to fix it? i tried to install Ubuntu 12.04 64Bit, 12.10 32 and 64Bit, but it doesn't work. I'm used the Ubuntu 12.04 32Bit Start Disc Creator and also Unetboot on Win7, the installation-process are finished and i restart without the Stick. I can choose for example 12.10 and it starts writing "start ... [OK], ...", but then it hangs most on "Stop Kernel Messages [OK]". Then i can only shutdown normal the system and it writes stopping, shutdown and something like that. I am use an Aspire One D270 Netbook with Intel Atom N2600. It also doesn't work to try Ubuntu 12.10 from running on USB Stick. It starts, but then its black and the cursor blink on the left upside. Please can you help me? :(

    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

  • Recover Data Like a Forensics Expert Using an Ubuntu Live CD

    - by Trevor Bekolay
    There are lots of utilities to recover deleted files, but what if you can’t boot up your computer, or the whole drive has been formatted? We’ll show you some tools that will dig deep and recover the most elusive deleted files, or even whole hard drive partitions. We’ve shown you simple ways to recover accidentally deleted files, even a simple method that can be done from an Ubuntu Live CD, but for hard disks that have been heavily corrupted, those methods aren’t going to cut it. In this article, we’ll examine four tools that can recover data from the most messed up hard drives, regardless of whether they were formatted for a Windows, Linux, or Mac computer, or even if the partition table is wiped out entirely. Note: These tools cannot recover data that has been overwritten on a hard disk. Whether a deleted file has been overwritten depends on many factors – the quicker you realize that you want to recover a file, the more likely you will be able to do so. Our setup To show these tools, we’ve set up a small 1 GB hard drive, with half of the space partitioned as ext2, a file system used in Linux, and half the space partitioned as FAT32, a file system used in older Windows systems. We stored ten random pictures on each hard drive. We then wiped the partition table from the hard drive by deleting the partitions in GParted. Is our data lost forever? Installing the tools All of the tools we’re going to use are in Ubuntu’s universe repository. To enable the repository, open Synaptic Package Manager by clicking on System in the top-left, then Administration > Synaptic Package Manager. Click on Settings > Repositories and add a check in the box labelled “Community-maintained Open Source software (universe)”. Click Close, and then in the main Synaptic Package Manager window, click the Reload button. Once the package list has reloaded, and the search index rebuilt, search for and mark for installation one or all of the following packages: testdisk, foremost, and scalpel. Testdisk includes TestDisk, which can recover lost partitions and repair boot sectors, and PhotoRec, which can recover many different types of files from tons of different file systems. Foremost, originally developed by the US Air Force Office of Special Investigations, recovers files based on their headers and other internal structures. Foremost operates on hard drives or drive image files generated by various tools. Finally, scalpel performs the same functions as foremost, but is focused on enhanced performance and lower memory usage. Scalpel may run better if you have an older machine with less RAM. Recover hard drive partitions If you can’t mount your hard drive, then its partition table might be corrupted. Before you start trying to recover your important files, it may be possible to recover one or more partitions on your drive, recovering all of your files with one step. Testdisk is the tool for the job. Start it by opening a terminal (Applications > Accessories > Terminal) and typing in: sudo testdisk If you’d like, you can create a log file, though it won’t affect how much data you recover. Once you make your choice, you’re greeted with a list of the storage media on your machine. You should be able to identify the hard drive you want to recover partitions from by its size and label. TestDisk asks you select the type of partition table to search for. In most cases (ext2/3, NTFS, FAT32, etc.) you should select Intel and press Enter. Highlight Analyse and press enter. In our case, our small hard drive has previously been formatted as NTFS. Amazingly, TestDisk finds this partition, though it is unable to recover it. It also finds the two partitions we just deleted. We are able to change their attributes, or add more partitions, but we’ll just recover them by pressing Enter. If TestDisk hasn’t found all of your partitions, you can try doing a deeper search by selecting that option with the left and right arrow keys. We only had these two partitions, so we’ll recover them by selecting Write and pressing Enter. Testdisk informs us that we will have to reboot. Note: If your Ubuntu Live CD is not persistent, then when you reboot you will have to reinstall any tools that you installed earlier. After restarting, both of our partitions are back to their original states, pictures and all. Recover files of certain types For the following examples, we deleted the 10 pictures from both partitions and then reformatted them. PhotoRec Of the three tools we’ll show, PhotoRec is the most user-friendly, despite being a console-based utility. To start recovering files, open a terminal (Applications > Accessories > Terminal) and type in: sudo photorec To begin, you are asked to select a storage device to search. You should be able to identify the right device by its size and label. Select the right device, and then hit Enter. PhotoRec asks you select the type of partition to search. In most cases (ext2/3, NTFS, FAT, etc.) you should select Intel and press Enter. You are given a list of the partitions on your selected hard drive. If you want to recover all of the files on a partition, then select Search and hit enter. However, this process can be very slow, and in our case we only want to search for pictures files, so instead we use the right arrow key to select File Opt and press Enter. PhotoRec can recover many different types of files, and deselecting each one would take a long time. Instead, we press “s” to clear all of the selections, and then find the appropriate file types – jpg, gif, and png – and select them by pressing the right arrow key. Once we’ve selected these three, we press “b” to save these selections. Press enter to return to the list of hard drive partitions. We want to search both of our partitions, so we highlight “No partition” and “Search” and then press Enter. PhotoRec prompts for a location to store the recovered files. If you have a different healthy hard drive, then we recommend storing the recovered files there. Since we’re not recovering very much, we’ll store it on the Ubuntu Live CD’s desktop. Note: Do not recover files to the hard drive you’re recovering from. PhotoRec is able to recover the 20 pictures from the partitions on our hard drive! A quick look in the recup_dir.1 directory that it creates confirms that PhotoRec has recovered all of our pictures, save for the file names. Foremost Foremost is a command-line program with no interactive interface like PhotoRec, but offers a number of command-line options to get as much data out of your had drive as possible. For a full list of options that can be tweaked via the command line, open up a terminal (Applications > Accessories > Terminal) and type in: foremost –h In our case, the command line options that we are going to use are: -t, a comma-separated list of types of files to search for. In our case, this is “jpeg,png,gif”. -v, enabling verbose-mode, giving us more information about what foremost is doing. -o, the output folder to store recovered files in. In our case, we created a directory called “foremost” on the desktop. -i, the input that will be searched for files. This can be a disk image in several different formats; however, we will use a hard disk, /dev/sda. Our foremost invocation is: sudo foremost –t jpeg,png,gif –o foremost –v –i /dev/sda Your invocation will differ depending on what you’re searching for and where you’re searching for it. Foremost is able to recover 17 of the 20 files stored on the hard drive. Looking at the files, we can confirm that these files were recovered relatively well, though we can see some errors in the thumbnail for 00622449.jpg. Part of this may be due to the ext2 filesystem. Foremost recommends using the –d command-line option for Linux file systems like ext2. We’ll run foremost again, adding the –d command-line option to our foremost invocation: sudo foremost –t jpeg,png,gif –d –o foremost –v –i /dev/sda This time, foremost is able to recover all 20 images! A final look at the pictures reveals that the pictures were recovered with no problems. Scalpel Scalpel is another powerful program that, like Foremost, is heavily configurable. Unlike Foremost, Scalpel requires you to edit a configuration file before attempting any data recovery. Any text editor will do, but we’ll use gedit to change the configuration file. In a terminal window (Applications > Accessories > Terminal), type in: sudo gedit /etc/scalpel/scalpel.conf scalpel.conf contains information about a number of different file types. Scroll through this file and uncomment lines that start with a file type that you want to recover (i.e. remove the “#” character at the start of those lines). Save the file and close it. Return to the terminal window. Scalpel also has a ton of command-line options that can help you search quickly and effectively; however, we’ll just define the input device (/dev/sda) and the output folder (a folder called “scalpel” that we created on the desktop). Our invocation is: sudo scalpel /dev/sda –o scalpel Scalpel is able to recover 18 of our 20 files. A quick look at the files scalpel recovered reveals that most of our files were recovered successfully, though there were some problems (e.g. 00000012.jpg). Conclusion In our quick toy example, TestDisk was able to recover two deleted partitions, and PhotoRec and Foremost were able to recover all 20 deleted images. Scalpel recovered most of the files, but it’s very likely that playing with the command-line options for scalpel would have enabled us to recover all 20 images. These tools are lifesavers when something goes wrong with your hard drive. If your data is on the hard drive somewhere, then one of these tools will track it down! Similar Articles Productive Geek Tips Recover Deleted Files on an NTFS Hard Drive from a Ubuntu Live CDUse an Ubuntu Live CD to Securely Wipe Your PC’s Hard DriveReset Your Ubuntu Password Easily from the Live CDBackup Your Windows Live Writer SettingsAdding extra Repositories on Ubuntu TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Awe inspiring, inter-galactic theme (Win 7) Case Study – How to Optimize Popular Wordpress Sites Restore Hidden Updates in Windows 7 & Vista Iceland an Insurance Job? Find Downloads and Add-ins for Outlook Recycle !

    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

  • Advantages of Ubuntu LTS versions over regular Ubuntu?

    - by Adam Matan
    Do the LTS versions of Ubuntu have any advantages for the non-paying customers (who don't get any support?) From the tech spec only, these versions seem outdated in many aspects - mainly drivers and installed software versions. For instance, My previous (bounty!) problem regarding the AGN 5100 drivers would have been solved under Ubuntu 9.04.

    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

  • Use Ubuntu’s Public Folder to Easily Share Files Between Computers

    - by Chris Hoffman
    You’ve probably noticed that Ubuntu comes with a Public folder in your home directory. This folder isn’t shared by default, but you can easily set up several different types of file-sharing to easily share files on your local network. This folder was originally meant for the Personal File Sharing tool, which is no longer included with Ubuntu by default. You can install the Personal File Sharing tool or use Ubuntu’s built-in file-sharing feature to share files. HTG Explains: What Is RSS and How Can I Benefit From Using It? HTG Explains: Why You Only Have to Wipe a Disk Once to Erase It HTG Explains: Learn How Websites Are Tracking You Online

    Read the article

  • How to Turn Your Ubuntu Laptop into a Wireless Access Point

    - by Chris Hoffman
    If you have a single wired Internet connection – say, in a hotel room – you can create an ad-hoc wireless network with Ubuntu and share the Internet connection among multiple devices. Ubuntu includes an easy, graphical setup tool. Unfortunately, there are some limitations. Some devices may not support ad-hoc wireless networks and Ubuntu can only create wireless hotspots with weak WEP encryption, not strong WPA encryption. HTG Explains: What Is RSS and How Can I Benefit From Using It? HTG Explains: Why You Only Have to Wipe a Disk Once to Erase It HTG Explains: Learn How Websites Are Tracking You Online

    Read the article

  • How to Create a Custom Ubuntu Live CD or USB the Easy Way

    - by Chris Hoffman
    There are several different ways to create custom Ubuntu live CDs. We’ve covered using the Reconstructor web app in the past, but some commenters recommended the Ubuntu Customization Kit instead. It’s an open-source utility found in Ubuntu’s software repositories. UCK offers more powerful features than Reconstructor does, but Reconstructor makes most tasks easier for novice users. Be sure to take a look at Reconstructor, too. How To Be Your Own Personal Clone Army (With a Little Photoshop) How To Properly Scan a Photograph (And Get An Even Better Image) The HTG Guide to Hiding Your Data in a TrueCrypt Hidden Volume

    Read the article

  • How to Create a Separate Home Partition After Installing Ubuntu

    - by Chris Hoffman
    Ubuntu doesn’t use a separate /home partition by default, although many Linux users prefer one. Using a separate home partition allows you to reinstall Ubuntu without losing your personal files and settings. While a separate home partition is normally chosen during installation, you can also migrate to a separate home partition after installing Ubuntu – this takes a bit of work, though. HTG Explains: What Is Windows RT and What Does It Mean To Me? HTG Explains: How Windows 8′s Secure Boot Feature Works & What It Means for Linux Hack Your Kindle for Easy Font Customization

    Read the article

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