inflate

InstantiationException when using subclass of EditTextPreference

杀马特。学长 韩版系。学妹 提交于 2019-12-18 07:14:49
问题 Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a password dialog before one can edit the preference by the EditTextPreference 's own dialog. Now I define the preference in the corresponding preferences.xml like this: <edu.myproject.pwprefs.PasswordProtectedEditTextPreference android:key="pref_password" android:title="@string/pref_password_title" android:summary="@string/pref_password_summary" android:dialogTitle="

Is this a bug in this gzip inflate method?

感情迁移 提交于 2019-12-18 04:50:27
问题 When searching on how to inflate gzip compressed data on iOS, the following method appears in number of results: - (NSData *)gzipInflate { if ([self length] == 0) return self; unsigned full_length = [self length]; unsigned half_length = [self length] / 2; NSMutableData *decompressed = [NSMutableData dataWithLength: full_length + half_length]; BOOL done = NO; int status; z_stream strm; strm.next_in = (Bytef *)[self bytes]; strm.avail_in = [self length]; strm.total_out = 0; strm.zalloc = Z_NULL

Inflate a view in a background thread

给你一囗甜甜゛ 提交于 2019-12-17 10:46:08
问题 I have a very simple question: Is or is it not possible to inflate a view (not add it to layout) in a background thread (ex: in the doInBackground of an AsyncTask )? I know that it is possible, because I have implemented most Activities in my application this way and never had a problem, until I had this problem on a Galaxy S: Android: android.view.InflateException: Binary XML file line #13: Error inflating class <unknown> in SAMSUNG Galaxy S I've been told that I should not inflate Views in

How can I decompress a gzip stream with zlib?

帅比萌擦擦* 提交于 2019-12-17 01:36:28
问题 Gzip format files (created with the gzip program, for example) use the "deflate" compression algorithm, which is the same compression algorithm as what zlib uses. However, when using zlib to inflate a gzip compressed file, the library returns a Z_DATA_ERROR . How can I use zlib to decompress a gzip file? 回答1: To decompress a gzip format file with zlib, call inflateInit2 with the windowBits parameter as 16+MAX_WBITS , like this: inflateInit2(&stream, 16+MAX_WBITS); If you don't do this, zlib

How can I decompress a gzip stream with zlib?

匆匆过客 提交于 2019-12-17 01:36:25
问题 Gzip format files (created with the gzip program, for example) use the "deflate" compression algorithm, which is the same compression algorithm as what zlib uses. However, when using zlib to inflate a gzip compressed file, the library returns a Z_DATA_ERROR . How can I use zlib to decompress a gzip file? 回答1: To decompress a gzip format file with zlib, call inflateInit2 with the windowBits parameter as 16+MAX_WBITS , like this: inflateInit2(&stream, 16+MAX_WBITS); If you don't do this, zlib

Android Fragment Inflate layout

点点圈 提交于 2019-12-14 03:25:47
问题 Hi I'm working with a view pager and fragments. I would like to override orientation changes so that the onCreateView method isn't run everytime the orientation changes. This is because a lot is run in onCreateView for my app which causes the orientation to be slow to change. Also things on my server are checked and what not too so there really is no reason for all of it to run just because the orientation changed. Here is what i've set up so far I have this on the MainActivity in the

Why don't inflated views respond to click listeners?

江枫思渺然 提交于 2019-12-13 03:06:49
问题 I'm trying to set a click listener for a button in my layout. The click listener is only triggered when I call findViewById() directly, and not when I take the view from the inflated layout: public class MyActivity extends Activity implements View.OnClickListener { private static final String TAG = "MyActivity"; @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.test ); Button button = (Button)findViewById( R.id

Android: android.view.InflateException: Binary XML file line #13: Error inflating class <unknown> in SAMSUNG Galaxy S

我与影子孤独终老i 提交于 2019-12-12 07:16:05
问题 I am having a strange error that seems to occur only in Samsung Galaxy S with Android 2.2 (I've tested the application in Motorola Milestone 2 Android 2.2 / Xperia X10 Android 1.6 / Nexus One Android 2.2 / Google G1 Android 1.5 and 1.5 emulator and in such devices the error does not occur). The complete stack trace is: ERROR/AndroidRuntime(28111): FATAL EXCEPTION: AsyncTask #2 ERROR/AndroidRuntime(28111): java.lang.RuntimeException: An error occured while executing doInBackground() ERROR

Decompress with gz* functions succeeded but failed with inflate* functions using zlib

☆樱花仙子☆ 提交于 2019-12-12 05:18:15
问题 I have a gzip file sample, with standard gzip header 1F 8B 08 00 ... , when I inflate it with inflate* functions in zlib, the output is only 11 bytes(in fact the output should be about 4KB), but when I decompress it with gz* functions, it produce the correct output, the code: using gz* (this can produce correct output): #define CHUNK 10240 int gz_decompress(const char *path) { gzFile f = gzopen(path, "rb"); if(!f) return -1; unsigned char result[CHUNK]; int bytes_read = gzread(f, result,

Android - RelativeLayout inflated as Button?

我怕爱的太早我们不能终老 提交于 2019-12-12 01:29:09
问题 I have a weird problem. While running my Android application, I receive Exception: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.RelativeLayout the code, where I try to get relativeLayout v = inflater.inflate(R.layout.home, null); RelativeLayout btn = (RelativeLayout) v.findViewById(R.id.my_button); in xml, I've got this: <RelativeLayout android:id="@+id/my_button" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background=