Skip to main content

Posts

Showing posts with the label android-intent

install / uninstall APKs programmatically (PackageManager vs Intents)

My application installs other applications, and it needs to keep track of what applications it has installed. Of course, this could be achieved by simply keeping a list of installed applications. But this should not be necessary! It should be the responsibility of the PackageManager to maintain the installedBy(a, b) relationship. In fact, according to the API it is: public abstract String getInstallerPackageName (String packageName) - Retrieve the package name of the application that installed a package. This identifies which market the package came from. The current approach Install APK using Intent Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(apkUri, "application/vnd.android.package-archive"); startActivity(intent); Uninstall APK using Intent: Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", getPackageManager().getPackageArchiveInfo(apkUri.getPath(), 0).packageName,null)); startActivity(intent); This i

Intent for selecting wallpaper with wallpaper region highlighting

I would like to know if it's possible to create an Intent that makes the gallery cropper show wallpaper highlighting. This feature has been introduced in Honeycomb. To get an idea of what I'm looking for have a look at the tablet on the image (the three blue rectangles). I had a look at the source code of the ICS gallery app, but I couldn't find what I'm looking for. Source: Tips4all

SQLlite Android. Managing data

Hi friends. I'll tell you the aim of this part of my app. I've got a SQLite dB which has 3 columns. First is "Quantity", Second is "Product" and third is "Price". Well, what i want to do is to get the whole dB and send it by email. This is what i have right now: public class Visual extends Activity { TextView tv; Button sqlGetInfo; long l ; long b=1; int c,i; String returnedQuantity ,returnedProduct ,returnedPrice; String[] filas; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.visual); tv = (TextView) findViewById(R.id.tvSQLinfo); sqlGetInfo = (Button) findViewById(R.id.EnviarPedido); SQLManager info = new SQLManager(this); info.open(); String data= info.getData(); info.close(); tv.setText(data); Up to here, my code works fine, it displays the data in the textView. Here is the problem. My dB has

SQLlite Android. Managing data

Hi friends. I'll tell you the aim of this part of my app. I've got a SQLite dB which has 3 columns. First is "Quantity", Second is "Product" and third is "Price". Well, what i want to do is to get the whole dB and send it by email. This is what i have right now: public class Visual extends Activity { TextView tv; Button sqlGetInfo; long l ; long b=1; int c,i; String returnedQuantity ,returnedProduct ,returnedPrice; String[] filas; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.visual); tv = (TextView) findViewById(R.id.tvSQLinfo); sqlGetInfo = (Button) findViewById(R.id.EnviarPedido); SQLManager info = new SQLManager(this); info.open(); String data= info.getData(); info.close(); tv.setText(data); Up to here, my code works fine, it displays the data in the textView. Here is the problem. My dB has

Android app crashes on load - classNotFoundException

This has been driving me mad for a couple of days :) IDEA is my weapon of choice. During an editing session of inconsequential changes (or so I thought) of adjusting layouts, nudging buttons a few pixels left to line up etc I compiled and ran the project. I got a ClassNotFoundException when my app starts. It is thrown by java.lang.Bootloader. I put a breakpoint on the call to the Bootloader and can see that the offending class is my main application class. Here's how it looks: public class Rands extends Application{ public static SharedPreferences preferences; private static ArrayList<Favourite> favourites; private static Rands instance; public Rands(){ instance = this; } and in the manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="rands.mycompany.com" android:installLocation="preferExternal" android:versionCode="8" android:versionName=&qu

My Program stops after 2nd intent in android

My android application stops after startActivity () call of my 2nd intent. It works perfectly for the first time with intents. But on the 2nd time its control doesn't pass to 3rd activity. I haven't displayed anything on 2nd activity. Is it the problem? Or is something with my AndroidManifest.xml file? Can some one help me? I have added the intent filter of three activities as shown below.Is it the problem? I am new to android so please help me! <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>

Android navaigation bar with ListView

i just did ListView like this: All source: ListView Now i want to add navigation bar like iPhone on top of this window: I was searching for some source how to do but just kind find. Maybe someone have bookmarked good tutorial how to do this ?

Android phonegap app : unable to retrieve an image taken by the camera using my own code (not phonegap"s)

Note- even though im using phonegap, the question is not about some issue in that. Hi, im developing a android app. my app is using phonegap 1.3. mi problem... Im using phonegap apis to take a picture and display it in my app. But whats happening is due to some reason the os kills my app after the camera is launched, so that after the photo is clicked, my app is relaunched and it doesnt get the info abt the taken picture. As a workaround to this problem ( the problem ), i designed a phonegap plugin which on app start checks if the app had crashed while taking a picture (some flags in code), and if it is restarting after crash, it retrieves the Pic.jpg taken by the camera and tries to displays it. The problem is that its not able to get the right image, or even a proper .jpg file for that matter. mi code... Phonegap makes an intent to start the camera and passes the uri for the Pic.jpg that it creates into that intent which it passes to startActivityForResult. In

How to retrieve sms date field in android

I'm new to Android programming and I was writing some test code to retrieve all the sms messages in the inbox using an sms intent. The code I wrote is as follows: Uri uri = Uri.parse("content://sms/inbox"); Cursor c = getContentResolver().query(uri, new String[]{"address","person","date","body"}, null, null, null); c.moveToFirst(); if(c.getCount() > 0){ while(!c.isLast()){ System.out.println(c.getString(c.getColumnIndex("date"))); c.moveToNext(); } } Is this the right way? I see that the value for the date column is retrieved as something like "1326781012725". I want to convert this into a readable format like YYYY-MM-DD.How can I do this? Note that I'm using API version 10 and hence the api - cursor.getType() (that returns the data type of the column) is not available. Thanks.

Android - TabHost

I have a tabhost implemented with three tabs and are functioning. What I wanted to know if there is any way back when to click the same tab is selected, it returns to its initial state (like a reset)? I managed to do this using the method "setOnClickListener" of each tab and start to get a new activity, but it does not matter because I notice the passage of activity. Thanks

Empty intent extras in onActivityResult

I have two activities. First calls second like this: Intent intent = new Intent(this, Second.class); startActivityForResult(intent, 1); returning data in second one: Intent intent = new Intent(); intent.putExtra("a", "la-la-la"); setResult(RESULT_OK, intent); finish(); and trying to receive this data in first activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((resultCode == Activity.RESULT_OK) && (currentTask != null)) { //Here is empty intent extas!!! Log.d("OrderActivity", "RESULT!!"); } } So, request code and response code returned, but intent extra is empty..??