Android :: How To Access Protected Fields From View Subclass?
Apr 19, 2010I'm implementing custom widget exdending a View class. But I've found that View's protected field (e.g. mLeft) is not accessible from subClass
View 2 RepliesI'm implementing custom widget exdending a View class. But I've found that View's protected field (e.g. mLeft) is not accessible from subClass
View 2 RepliesI'm trying to do basic authentication to view a protected url. I want to access the protected url which looks like this:
http://api.test.com/userinfo/vid?=1234. So I do the following with a WebView:
mWebView.setHttpAuthUsernamePassword("api.test.com", "", "me@test.com", "my password");
mWebView.loadUrl("http://api.test.com/userinfo/user?uid=53461");
but the authentication doesn't seem to work, I'm just getting an output error page. Am I using the WebView method correctly here?
Update:
Trying with curl: curl -u me@test.com:mypassword http://api.test.com/userinfo/user?uid=53461
and it pulls the page fine. I tried every combination of the host parameter, the owners of the api don't know what I mean by 'realm' though (and neither do I) - what info could I give them to help this along?
I'm subclassing Android's view class, but whenever I make an instance of the view from another class, the constructor never gets called (or so it seems). I've implemented both public myclass (Context context) and public myclass (Context context, AttributeSet, attrs) I can't figure out what I'm doing wrong. Do I need to override onDraw and onMeasure?
View 1 Replies View RelatedI've run into an early problem with developing for android. I've made my own custom View (which works well). In the beginning i just added it to the layout programmatically, but i figured i could try putting it into the XML layout instead (for consistency).
So what i got is this:
main.xml:
CODE:..........
(Theres obviously more, but you get the point)
Now, this is the stacktrace:
CODE:...........
Why cant i cast my custom view? I need it to be that type since it has a few extra methods in it that i want to access. Should i restructure it and have another class handle the logic, and then just having the view being a view? I'd really like this to work though.
I have dropbox, and love it. I go to school as well and have password protected PDF's, is there are reader that will allow me to enter the user name and password? I can't get the official Adobe Reader to selected the text fields. Are there any recommendations?
View 7 Replies View RelatedWhen I extend a View, I cannot access the protected member variables from my code. Eclipse just says that there exists no variable with that name (for instance mScrollX). Why is that?
View 2 Replies View Related"You know we can easily read password protected .ppt files on our computers by clicking onto READ ONLY..This allows us to check these files even if we don't know the password. On Android,some softwares such as Office Suite Pro etc. Can open password protected files but they demand password for it. Is there any possibility or way that I can view these password protected .ppt on my android without entering password as Read Only as I do on my computer."
View 1 Replies View RelatedI have a ListView that displays a set of notes, each with varying ammounts of data (i.e. some have a due date, others don't).Currently, each view in the list is a RelativeLayout containing a TextView for each field, plus two Button and a CheckBox. I then simply hide the unused fields by setting visible false on each one.This has worked well, but I'm about to add a lot more data fields to the notes and inflating that many unneeded views for each row will surely kill my app. I need a more dynamic solution.I've decided the best way to go is to create a custom view. How can I implement/design my view so that it can display a variable number of text fields without creating/ destroying textviews each time (which would be quite expensive and worse than my current situation), or maintaining a large pool of hidden textviews?
View 2 Replies View RelatedBe aware folks Rooting your Evo makes copy-protected apps "disappear" from the Market. I never had this problem on my rooted N1, however once I rooted Evo - it cannot see apps like NYTimes, bTunes, and basically any other app that's copy protected. I have read on XDA-forums that this has something to do with Market being affiliated with 'build.prop', but unclear as to what the fix for this will be, if any Right now, I am thinking of going back to stock because of this..
View 6 Replies View RelatedWe have a website that makes use of OAM for single sign on (form-based authentication). When we submit credentials to WebGate / Access Server the authorization succeeds, however after the authentication is performed, the form action (as configured in the Authentication Scheme - with passthrough:no) returns a server error instead of redirecting to the originally requested URL.
If we use Mini Opera, we are able to get authenticated and forwarded properly.
This problem happens on numerous Android phones (versions ranging from 1.5-2.2), as well as the Emulator provided with the SDK.
This is proving to be a real problem as the default browser on Android phones is not able to get access to our sites(and this is the only browser that is having this problem).
I have created a WebView-based custom browser with the hope of seeing a client-side error and tried trapping every possible error....none show up....
I have tried to trace all of the http requests and found only a single difference in the requests... the http header for Connection:keep- alive is not sent by the Android WebView.
I have provided some tracing info below...
CODE:....................
Can somebody please confirm that the Spring Hero used to have access to copy protected apps, however, after the upgrade to Android 2.1, they now don't?If this does get confirmed, is there any alternative to just removing the copy protection?Eg: If a user purchased a copy protected app, then they upgraded to Android 2.1 (which wipes the phone), they can't reinstall the copy protected app they purchased?
View 3 Replies View RelatedI would like to be able to save& view the data from 3 edit text fields and a date pick to an SQL lite DB. Can anybody point me to a decent beginners tutorial or perhaps give me an idea of where to start?
View 2 Replies View RelatedI'm attempting to override an Android View class to tweak the functionality just slightly. But I need to modify a field that does not have a setter method. I've placed the subclass in a package called android.widget. Why can't I access any of the package-private member fields? I notice that the compiler says they "cannot be resolved," rather than not being accessible. Does this have something to do with how Android.jar is built?
View 2 Replies View RelatedI have a Activity and I have a class which extends this Activity. In this subclass I call:
startActivity(new Intent(this, CameraView.class))
Which should start the "CameraView" Activity. However, I always get this error:
CODE:...........
If it makes any difference the subclass creates a ListView and when a row of the ListView is clicked it calls startActivity();
I have one subclass which extends Dialog class, it seems I can not use startActivity() function to start a new Activity in this subclass which extends Dialog class, how to resolve it?
How to start a new Activity in a Dialog subclass? (In my customized dialog subclass, I have one button, when pressed, I would like to have a new Activity start).
I have subclassed ArrayAdapter to set the color of text to RED if the string does not contain 100%, this has been added to a ListView. The problem is that some of the rows show as red when they contain 100%.
CODE:.....................
I don't think this problem is caused from my ListActivity subclass. I think it has something to do with with my BaseAdapter subclass:
package com.mohit.gtodo;
import com.mohit.gtodo.database.TasksDBAdapter;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CursorAdapter;
import android.widget.TextView;............................
From the documentation for android.app.Application:
"Base class for those who need to maintain global application state"
I am using my own subclass to maintain an object that I'm using to query a server. Also from the documentation:
"onTerminate() Called when the application is stopping."
However, onTerminate() in my class is never called. I press the back button while viewing my main activity, and everything seems to shut down. My main Activity's onDestroy() method is called and isFinishing() returns true, but my android.app.Application's onTerminate() method is never called.
In hierarchy viewer there are several IDs as shown above, for example "id/timepicker_input".
But I can't find a respective timepicker_input - ID when typing
myNumberPicker.findViewById(android.R.id. ...? );
So how to access these Views by their ID?
I've found a example on this site on how to make a subclass of the application for android.
I've created this code
package mensand.test;
class TestApp extends android.app.Application { }
Added this line to the manifest
android:name="mensand.test.TestApp"
And when i run the app it's starts with a force close message.
When i remove the line from the manifest all runs ok
I have a ListActivity which is being filled via an internal class "OrderAdapter" - while the list is being populated I set various OnClickListeners on the TextView elements which should open the same view with different parameter values per line. My problem I have is that no matter which entry in the list I click I will always get to a view with the same parameter ID (it's always the ID of the last line in the list) - even though the output of the ID varies if I output it to the TextView.
Here is the code of the internal class which populates the list in the ListActivity:
CODE:.............
Any ideas why it always opens the view with the same ID even though the TextView "tvCheatTitle" displays a different value in every line?
I have put some instructions in onLowMemory() callback and want to test the same. Is there a "direct" way to test onLowMemory function of the application subclass?
Or will I have to just overload the phone by starting many apps and doing memory intensive tasks?
I am having a problem with an application I am in the middle of writing which is causing me some serious headaches.
The situation is this:
The application allows the user to configure several different kinds of information in several activities.
One of the activities, which is a subclass of Activity, takes data from the user and stores it in a shared preferences instance that I create manually and edit in code. This activity requires a complex screen layout that I do not believe would work well with a PreferenceActivity, hence me rolling my own in this case.
Another one of the activities, which is a subclass of PreferenceActivity, is a straight forward list of preferences, each with a list options - standard stuff.
I am finding that any data that I store from the first activity, my bespoke preference screen which manually adds the data using a StoredPreferences.Editor instance is overwritten once the user selects an option in my activity that extends PreferenceActivity.
I get a NullPointerException calling a Superclass Method in Subclass Inner Class Constructor... What's the Deal?
In my application's main class (subclass of Application), I have a public inner class that simply contains 3 public string objects. In the parent class I declare an object of that inner class.
CODE:...................
After I instantiate the object in the constructor, I get a runtime error when I try to assign a value in the inner class with a superclass method.
Can you not call superclass methods in the subclass constructor?
Someone post the code for accessing .txt file available in my res folder. The code for which can be written in .java file.
View 4 Replies View RelatedThe View class has a compute Scroll method whose documentation states: Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. This will typically be done if the child is animating a scroll using a Scroller object. See
http://developer.android.com/reference/android/view/View.html#compute...
I am using the 1.5 SDK and I do not have access from within my application to the mScrollX and mScrollY protected member variables of the View class. However, I must have a custom scroller object for my view.
Full code. how do i access the parent activity's mail layout elements? In this case a button. I have it declared in main.xml. When a button in the listview is clicked, i want to change the text of the button in main.
View 1 Replies View RelatedIn my foo_layout.xml file I have a subclassed RelativeLayout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.android.myapp.FooView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/pegboard_table"
android:orientation="vertical"
android:scaleType="fitXY"
>
<ImageView
android:id="@+id/triangular"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/pegboard_board"
android:scaleType="fitXY"
android:gravity="center"
android:visibility="invisible"
/>
<Chronometer
android:id="@+id/timer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/timer_display"
android:textSize="40sp"
android:textColor="#000"
android:layout_alignParentTop="true"
android:gravity="center"
android:visibility="invisible"/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/board_table"
android:visibility="invisible"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:background="@drawable/tab_bar">
<!-- android:layout_alignLeft="@id/options_tab"-->
<ImageView
android:id="@+id/game_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/game_select" android:paddingLeft="15sp"/>
<ImageView
android:id="@+id/undo_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/game_select"
android:layout_weight="1"
android:src="@drawable/undo"
/>
<ImageView
android:id="@+id/settings_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/undo_select"
android:layout_weight="1"
android:src="@drawable/settings"
/>
<ImageView
android:id="@+id/info_select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/settings_select"
android:layout_weight="1"
android:src="@drawable/info"
This doesn't seem like the right behavior. I've tried it with other views inside the FooView hierarchy and findViewById() always returns null.
For the life of me I can't figure out what I'm doing wrong.
Does anybody know of an app that can view Microsoft Access Snapshot (.snp) files? I think they're basic images, but a proprietary format. I haven't seen anything in the market that looks like it would do the trick. I get these emailed to me from work and would love to be able to open them on my phone!
View 1 Replies View RelatedI want to auto select an image in gallery and focus the selected image. I know the position (index) of the image in gallery. I am trying to use in res/layout/main.xml
<Gallery
android:id="@+id/galleryView"
android:layout_below="@id/imageViewMap"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:layout_weight="1" />
in AlbumView.java
gallery = (Gallery) mView.findViewById(R.id.galleryView);
ImageView view = gallery.getItemAtPosition(position);
Unfortunately the above code is returning null. Can you please help in this matter.