commonsware

Image saved with wrong orientation

非 Y 不嫁゛ 提交于 2020-01-13 14:04:36
问题 I am using this code: https://github.com/commonsguy/cw-advandroid/blob/master/Camera/Picture/src/com/commonsware/android/picture/PictureDemo.java where in Manifest , Activity Orientation is set to Landscape . So, its like allowing user to take picture only in Landscape mode, and if the picture is taking by holding the device in portrait mode, the image saved is like this: a 90 degree rotated image. After searching for a solution, I found this: Android - Camera preview is sideways where the

Android Programming tutorials - Tutorial 5

こ雲淡風輕ζ 提交于 2019-12-23 05:17:38
问题 Hello, I am doing tutorials from book "Android programming tutorials", I am having problems understanding Tutorial 5. This is the main Java class: package tiago.tutorial; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.LayoutInflater; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListView; import android

Standard intent URI broken?

a 夏天 提交于 2019-12-22 05:39:06
问题 I'm having problems with intent URIs on a particular device, so I tried the CommonsWare URLHandler sample as suggested here: Launching my app using the intent URI, and the intent URI hyperlink on its sample page also fails to invoke the application. The sample declares its intent-filter like this: <intent-filter> <action android:name="com.commonsware.android.MY_ACTION" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />

Why do recipes promote overriding getItemViewType and getViewTypeCount when it doesn't seem necessary?

允我心安 提交于 2019-12-21 12:15:46
问题 I've been working through the Commonsware Android Programming Tutorials and in tutorial 5, extra credit 2, the challenge is to use multiple layouts for displaying rows in a ListView depending on the "type name" of the object (a Restaurant's "type" attribute, which is a String). As such, it suggests overriding getItemViewType and getViewTypeCount in a custom ArrayAdapter. In addition, the android docs and other online recipes or blog posts suggest the same. In this situation, following this

Not allowed to start service Intent without permission - sender does not get permissions

[亡魂溺海] 提交于 2019-12-12 11:45:09
问题 I'm working with Mark Murphy's excellent Commonsware books - but it's a lot to digest. I built the 'FakePlayer' app (pretends to be an mp3 player). It contains a service. As a learning experience I tried to write a trivial app (has only a button) whose click handler does: Intent i = new Intent(); i.setAction("com.example.cwfakeplayer.MyPlayerService"); Context context = getApplicationContext(); context.startService(i); It worked fine - the service start ok. I noticed Eclipse complaining about

What's the difference between passing this vs. ClassName.this from an event handler when passed to Intent constructor?

别来无恙 提交于 2019-12-12 07:53:05
问题 In the earlier Android Programming Tutorial, page 192, we see an implementation of LunchList#onOptionsItemSelected . Within this implementation we see two Intent s passed to startActivity : one whose constructor is passed LunchList.this , the other whose constructor is passed this . What's the difference? See lines 78 - 91 here. Note how onOptionsItemSelected is not declared within an inner class. In Android/Java does the value of this change within the context of event handlers or function

Can't find the leak, on my fragment android code

青春壹個敷衍的年華 提交于 2019-12-11 12:14:18
问题 I have a TabLayout, under each tab there is a Fragment (I'm using ArrayPagerAdapter). I've noticed that when I switch many times from a tab to another, my memory usage increase a lot. From my heap snapshot, I can see there are a lot of AutoCompleteTextView instances. So I am convinced that the problem could be here: public class MyFragment { ... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ... final MultiAutoCompleteTextView

XML attributes from merge layout to RelativeLayout via inflate

寵の児 提交于 2019-12-08 16:01:19
问题 According to this CommonsWare example I managed to get my RelativeLayout subclass to be merged with my layout described in a xml layout with merge root. My only concern is that I cannot describe my RelativeLayout parameters in xml. My xml layout: <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:my="http://schemas.android.com/apk/res/hu.someproject" android:layout_width="36dp" android:layout_height="wrap_content" android:layout

Image saved with wrong orientation

无人久伴 提交于 2019-12-06 00:35:57
I am using this code: https://github.com/commonsguy/cw-advandroid/blob/master/Camera/Picture/src/com/commonsware/android/picture/PictureDemo.java where in Manifest , Activity Orientation is set to Landscape . So, its like allowing user to take picture only in Landscape mode, and if the picture is taking by holding the device in portrait mode, the image saved is like this: a 90 degree rotated image. After searching for a solution, I found this: Android - Camera preview is sideways where the solution is: in surfaceChanged() check for Display display = ((WindowManager)getSystemService(WINDOW

Standard intent URI broken?

試著忘記壹切 提交于 2019-12-05 07:52:37
I'm having problems with intent URIs on a particular device, so I tried the CommonsWare URLHandler sample as suggested here: Launching my app using the intent URI , and the intent URI hyperlink on its sample page also fails to invoke the application. The sample declares its intent-filter like this: <intent-filter> <action android:name="com.commonsware.android.MY_ACTION" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> And the hyperlink in the sample web page is: <a href="intent:#Intent;action=com