Android 1.5 Spare parts Battery History does not display any data

by Jeff Sharkey » Thu, 21 May 2009 05:22:15 GMT


Sponsored Links
 Because the emulator doesn't have a battery?

j






-- 
Jeff Sharkey
jshar...@android.com

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Not receiving MotionEvents when transitioning between activities

I am working on an application that requires to monitor MotionEvents
between activities of the application. It consists of a RootActivity
and a ChildActivity. The RootActivity will open the ChildActivity via
an intent which occurs at the moment the ACTION_DOWN event is
received. However, once the Child Activity is created the RootActivity
is suppose to react to the ACTION_UP that is to follow the ACTION_DOWN
that was used to create the ChildActivity. Below is a snippet of code
to help with the explaination. This code works fine up 1.6 of Android.
However, in 2.0 and above of Android the code no longer works and I am
unable to receive any MotionEvents on the RootActivity once the
ChildActivity has been created.

Questions:
- How can I recieve the corresponding ACTION_UP on the RootActivity
once the ChildActivity has been created?
- Is there any way to know using code the state of the screen to check
if it is being pressed or not?


Code:
public class RootActivity extends Activity implements OnTouchListener
{
      private ListView list;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.rootview);

         list = (ListView) findViewById(R.id.rootlist);
         list.setOnTouchListener(this);
      }

     @Override
     public boolean dispatchTouchEvent(MotionEvent ev) {
         // Print Log

         return super.dispatchTouchEvent(ev);
     }

    public boolean onTouch(View v, MotionEvent event) {
          switch( event.getAction() ) {
          case MotionEvent.ACTION_DOWN:
              Intent intent = new Intent(actions.CHILD_ACTIVITY)
              intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              this.startActivity(inent);
              break;
          case MotionEvent.ACTION_UP:
              //Perform some other action
              break;
          }
          return true;
    }

}


-- 

2. MediaStore.ACTION_IMAGE_CAPTURE + Intent.FLAG_GRANT_WRITE_URI_PERMISSION

I was hoping to take a photo and enable only the camera app (or whatever
other app is bound to ACTION_IMAGE_CAPTURE) to store a photo in my content
provider.

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, MyPhotoStore.URI);

    // Grant permission to the camera activity to write the photo.
    intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    intent.setData(MyPhotoStore.URI);

    startActivityForResult(intent, REQUEST_PHOTO);

Calling setData() on the URI enables the other app to write to the URI, but
it also messes up the activity dispatch (I get ActivityNotFoundException).

I'd rather not specify a package with Context.grantUriPermission() because I
want it to work for any activity bound to ACTION_IMAGE_CAPTURE.

Is there any way to use FLAG_GRANT_WRITE_URI_PERMISSION
with ACTION_IMAGE_CAPTURE?

I guess an alternative is to use random URIs instead of the built-in
security.

Thanks,
Bob

-- 

3. Madu & Racun

4. Broadcast/notify/message when application is launched

5. mau tanya dong....need help

6. Package tracker

7. Search Market by Publisher Name