Search Results

Search found 135 results on 6 pages for 'pentium10'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Why my buttons OnClick event fails to fire?

    - by Pentium10
    I have an activity, where the ListView holds customized linear layout elements for each row. One of the rows has a button defined as: <Button android:text="Pick a contact" android:id="@+id/btnPickContact" android:layout_width="wrap_content" android:gravity="center_vertical" android:layout_height="wrap_content"></Button> Then in java, I have this code: ((Button) row.findViewById(R.id.btnPickContact)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); intent.putExtra(EXTRA_ONLINE_ID, (String)v.getTag(TAG_ONLINE_ID)); act.startActivityForResult(intent, PICK_CONTACT); } }); In this setup the event fails to start. Also I've tried by implementing the interface: @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); intent.putExtra(EXTRA_ONLINE_ID, (String)v.getTag(TAG_ONLINE_ID)); startActivityForResult(intent, PICK_CONTACT); } still no luck, the event doesn't fire. What to do?

    Read the article

  • How to clear an ImageView in Android?

    - by Pentium10
    I am resusing ImageViews for my displays, but at some point I don't have values to put it. So how to clear an ImageView in Android? I've tried: mPhotoView.invalidate(); mPhotoView.setImageBitmap(null); None of them have cleared the view, it still shows previous image.

    Read the article

  • getting the Contact's Birthday of a HTC Sense phone

    - by Pentium10
    I am not sure, but probably HTC Sense does the following, syncs my Facebook contacts to my phone along with their mobile number and their birthday. This shows well in the agenda and the user panel. But as it turns out it doesn't use the standard SDK way to store the birthdays. As if I use the following code to get the birthday of a contact it returns NO data for those contacts. public String getBirthday() { if (data.containsKey(BIRTHDAY)) { return CRUtils.getString(data, BIRTHDAY); } else { // read birthday Cursor c = ctx.getContentResolver() .query( Data.CONTENT_URI, new String[] { Event.DATA }, Data.CONTACT_ID + "=" + this.getId() + " AND " + Data.MIMETYPE + "= '" + Event.CONTENT_ITEM_TYPE + "' AND " + Event.TYPE + "=" + Event.TYPE_BIRTHDAY, null, null); if (c != null) { try { if (c.moveToFirst()) { String s = c.getString(0); this.setBirthday(s); return s; } } finally { c.close(); } } return ""; } } How can I fix this?

    Read the article

  • Show extra info for Preference screens when CheckboxPreference summary field is not enough long?

    - by Pentium10
    I have situation when you can enabled/disable modules for my Android application. For this I use a CheckboxPreference screen. This is all good, but the summary field gets cut off if longer descriptions are added than 2 lines. Suppose I have 4-5 lines of description available for each module, I would like to display this in a helper window. I tried to bind a click event to the CheckboxPreference, but that fires for the whole line, so not only when the checkbox is clicked, and more, where ever you click on the line the checkbox is toggled. So now I am wondering if this can be fixed. So if the user needs more info, just taps the text and the helper opens up, and if want to toggle the settings it taps the checkbox. How would you do it? I am open to other ideas too, if they do work.

    Read the article

  • Need some help with a join on ContentProviders

    - by Pentium10
    The documentation says Columns from the associated aggregated contact are also available through an implicit join. What's that implicit join? `Join with Contacts` String LOOKUP_KEY read-only See ContactsContract.Contacts String DISPLAY_NAME read-only See ContactsContract.Contacts long PHOTO_ID read-only See ContactsContract.Contacts. int IN_VISIBLE_GROUP read-only See ContactsContract.Contacts. int HAS_PHONE_NUMBER read-only See ContactsContract.Contacts. I am querying ContactsContract.Data, and I need to access as where clauses on the query IN_VISIBLE_GROUP and HAS_PHONE_NUMBER, that are defined in ContactsContract.Contacts. How can I make this possible?

    Read the article

  • How to set a dialog themed activity width to screen width?

    - by Pentium10
    I am followin the method described here to create an EditText input activity. But the view doesn't fill the width of the screen. How can I tell to fit the screen width? <activity android:name="TextEntryActivity" android:label="My Activity" android:theme="@android:style/Theme.Dialog"/> - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:orientation="vertical" android:gravity="right" android:layout_height="wrap_content"> <EditText android:text="@+id/txtValue" android:id="@+id/txtValue" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText> <Button android:text="Done" android:id="@+id/btnDone" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> </LinearLayout>

    Read the article

  • Making a database backup to SDCard on Android

    - by Pentium10
    I am using the below code to write a backup copy to SDCard and I get java.io.IOException: Parent directory of file is not writable: /sdcard/mydbfile.db private class ExportDatabaseFileTask extends AsyncTask<String, Void, Boolean> { private final ProgressDialog dialog = new ProgressDialog(ctx); // can use UI thread here protected void onPreExecute() { this.dialog.setMessage("Exporting database..."); this.dialog.show(); } // automatically done on worker thread (separate from UI thread) protected Boolean doInBackground(final String... args) { File dbFile = new File(Environment.getDataDirectory() + "/data/com.mypkg/databases/mydbfile.db"); File exportDir = new File(Environment.getExternalStorageDirectory(), ""); if (!exportDir.exists()) { exportDir.mkdirs(); } File file = new File(exportDir, dbFile.getName()); try { file.createNewFile(); this.copyFile(dbFile, file); return true; } catch (IOException e) { Log.e("mypck", e.getMessage(), e); return false; } } // can use UI thread here protected void onPostExecute(final Boolean success) { if (this.dialog.isShowing()) { this.dialog.dismiss(); } if (success) { Toast.makeText(ctx, "Export successful!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(ctx, "Export failed", Toast.LENGTH_SHORT).show(); } } void copyFile(File src, File dst) throws IOException { FileChannel inChannel = new FileInputStream(src).getChannel(); FileChannel outChannel = new FileOutputStream(dst).getChannel(); try { inChannel.transferTo(0, inChannel.size(), outChannel); } finally { if (inChannel != null) inChannel.close(); if (outChannel != null) outChannel.close(); } } }

    Read the article

  • Insert takes too long, code optimization needed

    - by Pentium10
    I have some code I use to transfer a table1 values to another table2, they are sitting in different database. It's slow when I have 100.000 records. It takes forever to finish, 10+ minutes. (Windows Mobile smartphone) What can I do? cmd.CommandText = "insert into " + TableName + " select * from sync2." + TableName+""; cmd.ExecuteNonQuery(); EDIT The problem is not resolved. I am still after answers.

    Read the article

  • How to get N random string from a {a1|a2|a3} format string?

    - by Pentium10
    Take this string as input: string s="planets {Sun|Mercury|Venus|Earth|Mars|Jupiter|Saturn|Uranus|Neptune}" How would I choose randomly N from the set, then join them with comma. The set is defined between {} and options are separated with | pipe. The order is maintained. Some output could be: string output1="planets Sun, Venus"; string output2="planets Neptune"; string output3="planets Earth, Saturn, Uranus, Neptune"; string output4="planets Uranus, Saturn";// bad example, order is not correct Java 1.5

    Read the article

  • How to test code built to save/restore Lifecycle of an Activity?

    - by Pentium10
    How can I test all of the following methods code? I want to play scenarios when all of them are happening to see if my code works for save/restore process of an activity. So what should I do in the Emulator to get all methods tested? public class Activity extends ApplicationContext { protected void onCreate(Bundle savedInstanceState); protected void onStart(); protected void onRestart(); protected void onResume(); protected void onPause(); protected void onStop(); protected void onDestroy(); }

    Read the article

  • Is there a faster method then StringBuilder for a max 9-10 step string concatenation?

    - by Pentium10
    I have this code to concate some array elements: StringBuilder sb = new StringBuilder(); private RatedMessage joinMessage(int step, boolean isresult) { sb.delete(0, sb.length()); for (int i = 0; i <= step; i++) { if (mStack[i] == null) continue; rm = mStack[i].getCurrentMsg(); if (rm == null || rm.msg.length() == 0) continue; if (sb.length() != 0) { sb.append(", "); } sb.append(rm.msg); } return sb.toString(); } Important the array holds max 10 items, so it's not quite much. My trace output tells me this method is called 18864 times, 16% of the runtime was spent in this method. Can I optimize more?

    Read the article

  • Generating different randoms valid for a day on different independent devices?

    - by Pentium10
    Let me describe the system. There are several mobile devices, each independent from each other, and they are generating content for the same record id. I want to avoid generating the same content for the same record on different devices, for this I though I would use a random and make it so too cluster the content pool based on these randoms. Suppose you have choices from 1 to 100. Day 1 Device#1 will choose for the record#33 between 1-10 Device#2 will choose for the record#33 between 40-50 Device#3 will choose for the record#33 between 50-60 Device#1 will choose for the record#55 between 40-50 Device#2 will choose for the record#55 between 1-10 Device#3 will choose for the record#55 between 10-20 Device#1 will choose for the record#11 between 1-10 Device#2 will choose for the record#22 between 1-10 Device#3 will choose for the record#99 between 1-10 Day 2 Device#1 will choose for the record#33 between 90-100 Device#2 will choose for the record#33 between 1-10 Device#3 will choose for the record#33 between 50-60 They don't have access to a central server. Data available for each of them: IMEI (unique per mobile) Date of today (same on all devices) Record id (same on all devices) What do you think, how is it possible? ps. tags can be edited

    Read the article

  • Why this cache doesn't work using final as modifier

    - by Pentium10
    I have this code to get the Cursor once for this instance, and the Log shows it is called many times although I marked as final. What I am missing? private Cursor getAllContactsCached() { final Cursor c=this.getList(); return c; } getAllContactsCached method should retrieve list once, and the 2nd time it should reuse the final object for return

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >