Hello Everybody,
I am currently developing a program that get all the running apps and the icon. That work pretty weel on more than 2.000 users but recently, a sprint hero user told me about a force close. After investigation, this line in causing problem:
Code:
BitmapDrawable iconDrawableBitmap=(BitmapDrawable) monPackageManager.getApplicationIcon(pckName);
with the processus com.htc.android.htcime and I get this error:
java.lang.RuntimeException: Unable to resume activity {my.package.name}: java.lang.ClassCastException: android.graphics.drawable.NinePatchDrawable
Click to expand...
Click to collapse
So I guess that the htc virtual keyboard on a Sprint Hero has a 9patch icon instead of a static bitmap or png like all the other softwares?
What sould i do to detect a 9patch and transform it into a Bitmap Ressource?
Thank a lot.
Profete162
But why do you want BitmapDrawable, not general Drawable object? You shouldn't do casting here, because this method may return any Drawable, not just BitmapDrawable or NinePatchDrawable. In the future you will have problems, because e.g. in some cases ClipDrawable will be returned.
I think you try to do something, that you shouldn't.
Hello
Thank you for the answer.
The reason why I don't want to use it as a drawable is simple: after in my code, i draw the icons of all the applications in a canvas.
And i draw with canvas.drawBitmap(...) and I cannot use a drawable there, so I need a Bitmap.
So, is there an other method to draw a Drawable in a canvas?
I am not an Android Guru, but I feel like when I have a number coded as a string and I need an integer for mathematical operations, no?
Thank a lot.
profete162 said:
So, is there an other method to draw a Drawable in a canvas?
Click to expand...
Click to collapse
I don't have much experience in developing Android apps, but I found this method:
http://developer.android.com/refere...e/Drawable.html#draw(android.graphics.Canvas)
Brut.all said:
I don't have much experience in developing Android apps, but I found this method:
Click to expand...
Click to collapse
Yes, and....?
This doesn't allow me to use a Drawable.... I need to instanciate it as a Bitmap and then draw into a canvas..
profete162 said:
This doesn't allow me to use a Drawable....
Click to expand...
Click to collapse
Errr... this is method of a Drawable
A part of my own code : I use Bitmap instead of Drawable, and create the Bitmap from the Drawable with my dTob method.
public static Bitmap dTob(Drawable drawable) {
Bitmap bmp = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Config.ARGB_4444);
Canvas c = new Canvas(bmp);
drawable.setBounds(new Rect(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight()));
drawable.draw(c);
return bmp;
}
Click to expand...
Click to collapse
Related
Hey,
So I'm making an app that needs to display a bitmap or raw (something where X/Y pixels can be modified, so no compression like a jpg).
There's an Activity which contains only an ImageView, I get the Bitmap from the bundle given in the callback from the camera (it's put into the intent before the Activity starts), then I set it to the ImageView in onCreate of this new Activity (which is basically only an ImageView).
For some reason, when viewing this Activity, the picture is of EXTREMELY low quality. Like, tons of jaggies, like it's a thumbnail or something and is force-scaled up to the screen size. The image isn't really like this, though, when I view it in my gallery it's crystal clear. So why is the quality being dragged down to all hell when I set it in the ImageView? I don't care about the performance constraints, this isn't a production app.
I feel there's some quality control function in the ImageView or something, but I have no idea what. Can somebody tell me the "why" or the "fix" - plzzzz - I'm on a really truncated time schedule and haven't had much luck with this camera for too long .
TIA
Syndacate said:
Hey,
So I'm making an app that needs to display a bitmap or raw (something where X/Y pixels can be modified, so no compression like a jpg).
There's an Activity which contains only an ImageView, I get the Bitmap from the bundle given in the callback from the camera (it's put into the intent before the Activity starts), then I set it to the ImageView in onCreate of this new Activity (which is basically only an ImageView).
For some reason, when viewing this Activity, the picture is of EXTREMELY low quality. Like, tons of jaggies, like it's a thumbnail or something and is force-scaled up to the screen size. The image isn't really like this, though, when I view it in my gallery it's crystal clear. So why is the quality being dragged down to all hell when I set it in the ImageView? I don't care about the performance constraints, this isn't a production app.
I feel there's some quality control function in the ImageView or something, but I have no idea what. Can somebody tell me the "why" or the "fix" - plzzzz - I'm on a really truncated time schedule and haven't had much luck with this camera for too long .
TIA
Click to expand...
Click to collapse
what other info does the camera intent return, what extras?
alostpacket said:
what other info does the camera intent return, what extras?
Click to expand...
Click to collapse
How do I check?
I used somebody else's tutorial to learn that the URI is in the 'data' of the bundle.
I tried checking earlier by using its to-string, but that just gave me the container size.
Syndacate said:
How do I check?
I used somebody else's tutorial to learn that the URI is in the 'data' of the bundle.
I tried checking earlier by using its to-string, but that just gave me the container size.
Click to expand...
Click to collapse
you probably have the URI to the thumbnail
Post the tutorial you used and some code, shouldn't be too hard to figure out.
alostpacket said:
you probably have the URI to the thumbnail
Post the tutorial you used and some code, shouldn't be too hard to figure out.
Click to expand...
Click to collapse
There's like upteen thousand tutorials that I compiled to make what I have.
I have no "links" anymore.
I got the Intent from the camera in the onActivityResult function after calling the camera. I pulled the bundle from it using the getExtras() function on the intent.
I then passed that intent to the new Intent I made to create my second Activity. I passed it via the putExtras function on the new intent.
In essence, I did;
Code:
Intent in = new Intent();
in.putExtras(incoming_intent_from_camera.getExtras());
And then called my second Activity.
In the onCreate() function of my second Activity, I pull the bitmap data using:
Code:
Bitmap bmp = (Bitmap)getIntent().getExtras().get("data");
There are two things in this Bundle, data (a Bitmap (android.graphics.Bitmap)) and a bitmap-data, which is a boolean.
EDIT:
Yes, it is definitely the URI to the thumbnail, I need the large image URI.
I have a feeling the problem is that it needs the EXTRA_OPTION string, the only issue is, I don't want to save this any place in particular. I'll let the camera save it to the default location on my SDCard. I just want the URI to that full size or something usable.
I can't do:
Code:
intent.putExtra(MediaStore.EXTRA_OPTION, <URI>);
Because I don't have nor want an additional URI to store it... I got to get EXTRA_OPTION to the camera somehow..
Okay, so here's the deal, that apparently nobody was able to help me with ():
- Like alostpacket said, the "data" key in the bundle returned from the camera activity (in the callback) contains the URI to the thumbnail - that's useless unless I'm making an icon or some other small/tiny/low res picture.
I was correct in the fact that it had something to do with putting the EXTRA_OPTION into the extras that I passed off to the camera intent.
This DID come at a price, though. You have to make a temporary place to store the image (you know, because the regular one in the gallery just isn't good enough of or something). And by temporary I kind of mean permanent, it gets overwritten every time (assuming you use the same path), but won't get removed. I am unable to understand this functionality. If somebody could explain it that would be great.
So all in all my intent to the camera looks like this:
Code:
image_path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmp_image.jpg";
File img = new File (image_path);
Uri uri = Uri.fromFile(img);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(intent, PICTURE_REQUEST);
Where image_path is a private class String and PICTURE_REQUEST is a final String (also class level scope) - which can represent any non-0 number, but is unique to the request (think of it as a request ID).
Then, in the callback function, after checking to make sure the request code is PICTURE_REQUEST, and the resultCode was OK:
Code:
Bitmap bmp = BitmapFactory.decodeFile(image_path);
img_view.setImageBitmap(bmp);
img_view.invalidate();
Where image_path is (a String) wherever the image specified as an extra to the camera activity, img_view is an ImageView display element. The invalidate method will redraw the ImageView.
I hope that helps somebody else stuck in the same position I am.
I'm going to leave this question as "unresolved" because there's one thing I still can't figure out. The "EXTRA_OUTPUT" extra passed to the intent seems like a work-around. All that does is define an alternate path to write the file to, then the callback (or whatever) grabs it from there. It's a hack and a half. There has to be a legit way to grab the full quality image taken with the camera. Whether that's accessing the gallery intent or not I'm not sure, but this is definitely a work around. I hope somebody can provide the answer to that, because a lot of tutorials mention the EXTRA_OUTPUT method, and given what it does, I don't believe that is correct.
Hi,
The problem is: I want to add items to listview row, but in this row I dont know how many item it can have, so I can not pin down the items(textViews) in the layout xml, I have to add them programmatically. How can I do that?
Thanks
avlisF said:
Hi,
The problem is: I want to add items to listview row, but in this row I dont know how many item it can have, so I can not pin down the items(textViews) in the layout xml, I have to add them programmatically. How can I do that?
Thanks
Click to expand...
Click to collapse
You will need to write your own Adapter extending BaseAdapter. Override this method:
Code:
public View getView(int position, View convertView, ViewGroup parent)
In most of the tutorials you will find on the internet, they will inflate a xml file there. So read about creating Views in your Java code. You will find many tutorials on that topic. That lets you decide how many Views you add to a row. Just do it in the Java code.
nikwen said:
You will need to write your own Adapter extending BaseAdapter. Override this method:
Code:
public View getView(int position, View convertView, ViewGroup parent)
In most of the tutorials you will find on the internet, they will inflate a xml file there. So read about creating Views in your Java code. You will find many tutorials on that topic. That lets you decide how many Views you add to a row. Just do it in the Java code.
Click to expand...
Click to collapse
Thanks, it solve my problem
avlisF said:
Thanks, it solve my problem
Click to expand...
Click to collapse
Great.
Guys. Help me. I'm learning to ''Respond to the Send Button'' but I don't know what to do. I follow this step but I still can't understand.
http://developer.android.com/training/basics/firstapp/starting-activity.html
If you guys can help me, I'm really grateful.
Merivex95 said:
Guys. Help me. I'm learning to ''Respond to the Send Button'' but I don't know what to do. I follow this step but I still can't understand.
http://developer.android.com/trainin...-activity.html
If you guys can help me, I'm really grateful.
Click to expand...
Click to collapse
That link didn't work, but if you Google 'android java button onclick listener' that will get you started with plenty of helpful links.
When the button is clicked, you then need to check the content of the Edit Text field - Something like this:
Code:
public void onClick(final View v) {
final String commandText = inputText.getText().toString();
if (commandText != null && commandText.length() > 0) {
Where inputText is the Edit Text field you've assigned in your OnCreate method.
Getting started involves a lot of head scratching, but don't give up! There's so much Open Source code out there, that the penny will drop soon.
brandall said:
That link didn't work, but if you Google 'android java button onclick listener' that will get you started with plenty of helpful links.
When the button is clicked, you then need to check the content of the Edit Text field - Something like this:
Code:
public void onClick(final View v) {
final String commandText = inputText.getText().toString();
if (commandText != null && commandText.length() > 0) {
Where inputText is the Edit Text field you've assigned in your OnCreate method.
Getting started involves a lot of head scratching, but don't give up! There's so much Open Source code out there, that the penny will drop soon.
Click to expand...
Click to collapse
OMG !! this is the link : http://developer.android.com/training/basics/firstapp/starting-activity.html
I don't know how to compile the code properly. hummmm ... maybe you can help me by correcting my code ?
Paste code (variables, functions, etc) inside your MainActivity class and don't write 3 dots, it's just a replacement for skipped parts
Mikanoshi said:
Paste code (variables, functions, etc) inside your MainActivity class and don't write 3 dots, it's just a replacement for skipped parts
Click to expand...
Click to collapse
Ohhh yeahhh :cyclops: .. how can I be so stupid
btw ,, where should I put this code ?
code:
Code:
@override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}
Code:
Merivex95 said:
btw ,, where should I put this code ?
Click to expand...
Click to collapse
Replace existing onCreate function with it.
Mikanoshi said:
Replace existing onCreate function with it.
Click to expand...
Click to collapse
But I get an error after doing that ..
Merivex95 said:
But I get an error after doing that ..
Click to expand...
Click to collapse
You need to import TextView and Intent first. Just hover over the names and select import from the menu you will see.
Seriously, my advice would be to learn and understand Java first. It doesn't make sense to learn Android if you don't know Java (and it won't work).
nikwen said:
You need to import TextView and Intent first. Just hover over the names and select import from the menu you will see.
Seriously, my advice would be to learn and understand Java first. It doesn't make sense to learn Android if you don't know Java (and it won't work).
Click to expand...
Click to collapse
Thanks for the advice
nikwen said:
It doesn't make sense to learn Android if you don't know Java (and it won't work).
Click to expand...
Click to collapse
Unless you know any other similar languages. Java was the easiest lang to learn for me, after years of writing on Object Pascal/Object C/C++/JavaScript/PHP. The most troublesome part of coding for Android is creating an UI, especially cross-version compatible :laugh:
I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
StEVO_M said:
I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
Click to expand...
Click to collapse
I had a look at the source and from my understanding the important class here is that DataManager class here. Especially the getTopSetPath() with the static final Strings and maybe the mapMediaItems() methods seem to be where you need to look at. You might have to play around a bit, but this is where I would start.
SimplicityApks said:
I had a look at the source and from my understanding the important class here is that DataManager class here. Especially the getTopSetPath() with the static final Strings and maybe the mapMediaItems() methods seem to be where you need to look at. You might have to play around a bit, but this is where I would start.
Click to expand...
Click to collapse
I have tried adding/changing the following
Added...
//Setting Folder Path
public static final String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
Changed...
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = targetPath;
private static final String TOP_IMAGE_SET_PATH = "/combo/{/mtp,/local/image,/picasa/image}";
private static final String TOP_VIDEO_SET_PATH = "/combo/{/local/video,/picasa/video}";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I even tried setting all of the _PATH s to my targetPath
And I get a NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): Caused by: java.lang.NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): at com.myprivgallery.common.Utils.checkNotNull(Utils.java:48)
Which leads me to this in Utils.java
line 46 // Throws NullPointerException if the input is null.
line 47 public static <T> T checkNotNull(T object) {
line 48 if (object == null) throw new NullPointerException();
line 49 return object;
line 50 }
So if I am reading correctly, it is saying the path is empty. But I know that path works in other apps and it is not empty.
StEVO_M said:
I have tried adding/changing the following
Added...
//Setting Folder Path
public static final String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
Changed...
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = targetPath;
private static final String TOP_IMAGE_SET_PATH = "/combo/{/mtp,/local/image,/picasa/image}";
private static final String TOP_VIDEO_SET_PATH = "/combo/{/local/video,/picasa/video}";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I even tried setting all of the _PATH s to my targetPath
And I get a NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): Caused by: java.lang.NullPointerException
12-13 11:07:47.881: E/AndroidRuntime(23029): at com.myprivgallery.common.Utils.checkNotNull(Utils.java:48)
Which leads me to this in Utils.java
line 46 // Throws NullPointerException if the input is null.
line 47 public static <T> T checkNotNull(T object) {
line 48 if (object == null) throw new NullPointerException();
line 49 return object;
line 50 }
So if I am reading correctly, it is saying the path is empty. But I know that path works in other apps and it is not empty.
Click to expand...
Click to collapse
I don't think you can call an Environment method when static class variables are Initialised make sure that your String is the correct path with Logs, I would probably make that an instance variable instead...
SimplicityApks said:
I don't think you can call an Environment method when static class variables are Initialised make sure that your String is the correct path with Logs, I would probably make that an instance variable instead...
Click to expand...
Click to collapse
It may kinda look like I know what I'm doing, but looks are deceiving.
I really have no clue what I am doing. I consider myself a hack. I can some what look at code and then make it do what I want, but to actually program something new... I will see if I can't figure that out. But I really do appreciate your help.
StEVO_M said:
It may kinda look like I know what I'm doing, but looks are deceiving.
I really have no clue what I am doing. I consider myself a hack. I can some what look at code and then make it do what I want, but to actually program something new... I will see if I can't figure that out. But I really do appreciate your help.
Click to expand...
Click to collapse
Well then you should probably get started on a simpler app you've built yourself rather than trying to understand this very complex Gallery app (which in my view is poorly commented and documented)...
I had a closer look at the source and it seems that we are on the right track because the _PATH s are used in the getTopSetPath method of the DataManager, and a search reveals that it is called by various activities and pickers. If you're using one of those in your app we should be right.
Now let's get back to the basics, when the app is launched, the default launcher activity is Gallery.java. During it's creation, either startDefaultPage, startGetContent or startViewAction is called, but all of them have the following call:
Code:
data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(DataManager.INCLUDE_ALL)); // or some other variable
So this is the path where the images are loaded. Honestly, I have no idea what the
Code:
"/combo/{/mtp,/local/all,/picasa/all}"
is doing in the path variable, it has to do something with the Combo classes in the data folder, since the app is loading images from different dirs. You can now call your Environment call there and somehow pass back Strings instead of Paths, but it would be nicer if we could somehow figure out the these Paths are used here. An important class is the LocalPhotoSource.java. That is also where getImage from the DataManager is called. You could have a look at that class as well. Which path do you want the gallery to scan actually? The best solution would be to further experiment with the _PATH String, without calling Environment as well as debugging the whole app from the start, so you can get an idea of how everything is working.
SimplicityApks said:
Well then you should probably get started on a simpler app you've built yourself rather than trying to understand this very complex Gallery app (which in my view is poorly commented and documented)...
I had a closer look at the source and it seems that we are on the right track because the _PATH s are used in the getTopSetPath method of the DataManager, and a search reveals that it is called by various activities and pickers. If you're using one of those in your app we should be right.
Now let's get back to the basics, when the app is launched, the default launcher activity is Gallery.java. During it's creation, either startDefaultPage, startGetContent or startViewAction is called, but all of them have the following call:
Code:
data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(DataManager.INCLUDE_ALL)); // or some other variable
So this is the path where the images are loaded. Honestly, I have no idea what the
Code:
"/combo/{/mtp,/local/all,/picasa/all}"
is doing in the path variable, it has to do something with the Combo classes in the data folder, since the app is loading images from different dirs. You can now call your Environment call there and somehow pass back Strings instead of Paths, but it would be nicer if we could somehow figure out the these Paths are used here. An important class is the LocalPhotoSource.java. That is also where getImage from the DataManager is called. You could have a look at that class as well. Which path do you want the gallery to scan actually? The best solution would be to further experiment with the _PATH String, without calling Environment as well as debugging the whole app from the start, so you can get an idea of how everything is working.
Click to expand...
Click to collapse
I tried Changing the following in LocalAlbumSet.java
public class LocalAlbumSet extends MediaSet {
public static final Path PATH_ALL = Path.fromString("/DCIM/_private/.nomedia/all");
public static final Path PATH_IMAGE = Path.fromString("/DCIM/_private/.nomedia/image");
public static final Path PATH_VIDEO = Path.fromString("/DCIM/_private/.nomedia/video");
and Changing all of the TOP_..._Path s to
// This is the path for the media set seen by the user at top level.
private static final String TOP_SET_PATH = "/local/all";
private static final String TOP_IMAGE_SET_PATH = "/local/image";
private static final String TOP_VIDEO_SET_PATH = "/local/video";
private static final String TOP_LOCAL_SET_PATH = "/local/all";
private static final String TOP_LOCAL_IMAGE_SET_PATH = "/local/image";
private static final String TOP_LOCAL_VIDEO_SET_PATH = "/local/video";
I now see Random Images from /DCIM/_private/.nomedia but not all of them, which is really confusing. But at least it's a start.
StEVO_M said:
I have found a Gallery App on GitHub (https://github.com/sevenler/Android_Gallery2D_Custom) that I have integrated into my own app.
Currently the gallery displays all images from my device. What I would like to have is that it ONLY display the images starting at the folder on my sdcard that I specify such as..
private static String targetPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/_private/.nomedia";
I tried several different modifications but I am really struggling.
I was hoping someone could take a look at the source code for the Gallery App on GitHub and tell me how to change it so it does not scan my entire device.
Thanks in advance!!
-Steve
Click to expand...
Click to collapse
Android gallery will not scan any folder having a .nomedia file in it.
EatHeat said:
Android gallery will not scan any folder having a .nomedia file in it.
Click to expand...
Click to collapse
So I am guessing there is no way to Force your own instance to scan it????
StEVO_M said:
So I am guessing there is no way to Force your own instance to scan it????
Click to expand...
Click to collapse
Delete the .nomedia file.
Lol. Not an option if I want to hide my pic.
Sent from my HTCONE using Tapatalk
Not sure what you are trying to achieve, if you want to scan it then why would you want to hide it?
If you want to add an option to allow it to scan or not, you could backup the .nomedia to another directory and delete it for the time being.
Just an idea, can't say for sure. Didn't try it ever.
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Sent from my HTCONE using Tapatalk
StEVO_M said:
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Click to expand...
Click to collapse
Well why do you need to? Make your app fulfill only one purpose, so let it hide the pictures (I guess by moving a .nomedia file into the folder right?) and then just create a shortcut in your app to the gallery app so the user can still use their preferred one... Makes more sense to me and is way less work.
StEVO_M said:
I have created an app to hide pictures. Currently I have a very basic gallery. I was trying integrate this gallery because it has a lot more option such as editing and adding filters and such.
Sent from my HTCONE using Tapatalk
Click to expand...
Click to collapse
A far more simple and logical way would be to create a hidden folder on the SD card with a .nomedia file in it. Images/videos that are to be hidden can be moved to that location. This would keep it hidden from the gallery and can only be accessed through your private gallery.
For unhiding media, just move them back to their original folders.
Let me try to explain further... As I said, I have created an app already that does the Basic things.
My Application looks like a standard App, a "To Do List", but if you press and hold an Icon on the main screen it prompts you for a Password (These passwords are setup on first use).
Now... Depending on which password you enter, it will either take you to the hidden Gallery OR if you enter a different password it will take you to a Hidden To Do List. This is so anyone that may stumble upon your app, you can show them that it's has a hidden area of the app. This way they have no clue you really have a Hidden Gallery.
If you enter the Hidden Gallery password then it would of course, take you to the hidden gallery.
The Current Features are...
Import from Main Gallery
Pinch to Zoom
Swipe
Share
Restore back to Main Gallery
Delete
Quick Escape ------ "Quick Escape" can be activate 2 ways. If you shake the phone while in the Hidden Gallery, the image will change to an image of your choosing or the default one that is set during install. OR..... A less obvious "Quick Escape" ... While in the Hidden Gallery, press the volume up or down and the image will switch. Either way, once it is in that mode, you can not press back. the only way out it to press the home button. This is designed so if someone grabs the phone out of your hand they will only see they Quick Escape" image and pressing back will not take them back to the gallery.
My app also appears in the standard Share menu, so if you are in your Main Gallery and want to hide a picture, you can share it to my app and it will then hide the picture.
I want to add More features to my Gallery, such as Filters, Editing (crop, rotate...), Frames... All the same things that you can do in the Main Gallery. The only thing I really don't want or need is a Camera function. I can't see someone taking the time to open my app and then get to the Hidden Gallery and then taking a picture, just so they can hide an image. Most would just take the picture as they always would and then "Share" it to my app.
I hope this explains Why I want to use the other Gallery rather than reinventing the wheel that already has all of these features built in. If I can not get that to work, maybe I can just pull the Features out and use those.
Anyone who wants to actually See the app in action, PM me and I will send you a DropBox link to install. FYI, It requires 4.0 or higher.
[Q] Beginner: Issues with canvas bitmaps, buttons, and layouts
Hi, I'm hoping people might help me with this more open-ended question. I'm fairly new to programming with little scripting experience.
My problem is that I'm cobbling code together from various separate examples, but trying to implement them into my tests, they don't seem to work together.
Let me show you what my goals are for this experiment:
1) Create Button
2) Generate Images with Button click
3) Drag Images around
So far, I've been able to do create images with drawing bitmaps using canvas and create a working button with the easy drag and drop.
My specific problem is that I can't use the Design tool to create buttons if I use the canvas method of drawing bitmaps because setContentView() needs to be on the canvas.
Here's my onCreate():
Code:
GenerateItem ourView;
Button genButton;
LinearLayout myLinearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ourView = new GenerateItem(this);
setContentView(ourView);
myLinearLayout = (LinearLayout)findViewById(R.id.linearLayout1);
genButton = new Button(this);
genButton.setText("Generate");
myLinearLayout.addView(genButton);
}
And related XML code from my AndroidManifest:
Code:
<LinearLayout xmlns:android="somelink"
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
Now I have two questions:
1) Am I going about this problem the correct way using a mix of Design layout tools and code created images (canvas bitmaps)?
2) Can I use canvas bitmaps with an onTouchListener as a button?
Whoaness said:
2) Can I use canvas bitmaps with an onTouchListener as a button?
Click to expand...
Click to collapse
You should use an ImageView instead. Canvas aren't Views, so they aren't managed by the Android System when an event occurs. Canvas are used, for example, to draw anything in a low-level-way (custom views, for example).
I didn't understand the first question..
Sent from my Vodafone 875
Andre1299 said:
You should use an ImageView instead. Canvas aren't Views, so they aren't managed by the Android System when an event occurs. Canvas are used, for example, to draw anything in a low-level-way (custom views, for example).
I didn't understand the first question..
Sent from my Vodafone 875
Click to expand...
Click to collapse
You might have answered my first question. I'm not sure.
I was asking whether I should stick with canvas methods and, from my limited scripting knowledge, draw a hitbox for the onTouch method to detect so I can redraw the object to the fingers position.
I can easily drag imageviews/imagebuttons around. I guess I have to figure out how to create Imageviews, though I think I seen a way to cast bitmaps into an imageview, but it never worked out for me.
Whoaness said:
You might have answered my first question. I'm not sure.
I was asking whether I should stick with canvas methods and, from my limited scripting knowledge, draw a hitbox for the onTouch method to detect so I can redraw the object to the fingers position.
I can easily drag imageviews/imagebuttons around. I guess I have to figure out how to create Imageviews, though I think I seen a way to cast bitmaps into an imageview, but it never worked out for me.
Click to expand...
Click to collapse
Uhm... so, let me know wheter I understood.
In your project you have a button that renders an image (a bitmap) wich is drawn with a canvas. But you want that this image is draggable.
Am I right?
Andre1299 said:
Uhm... so, let me know wheter I understood.
In your project you have a button that renders an image (a bitmap) wich is drawn with a canvas. But you want that this image is draggable.
Am I right?
Click to expand...
Click to collapse
Yes, draggable image button. Although I'm not sure if it needs to be a button, but I thought button properties would be appropriate for touch and dragging.
Sorry for the late reply. I was on a hiatus.