I apologise if if 'hover assist' isn't the right terminology but I'm referring to the feature in Eclipse where if the use hovers the pointer over a method, a popup box appears with javadoc type information and invites the user to press F2 for focus. I see inconsistent behaviour for different methods, in that sometimes the browser gives me a file not found error when I click on a highlighted subject in that box.
I can best illustrate this by means of a snippet of code from a test project. I have the method:
#Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
... etc
...
}
If I hover over 'getSystemService' I see:
.
and then click on 'String' it takes me to the javadocs page
file:///C:/dev/tools/android-sdk-windows4.0/docs/reference/java/lang/String.html
on my machine in the browser. (I use the Firefox external browser) and this is just what I want.
However if I hover over the onCreate, I see:
Then if I click on the 'Bundle' link, I get this in the browser:
**File not found
Firefox can't find the file at /C:/dev/projects/EclipseIndigo/AndroidWorkTwo/CompassTwo/src/reference/android/os/Bundle.html.**
I have built the project with Android 2.3.3 jar and the javadoc properties show
which validates OK. I don't understand this inconsistent behaviour. Any help will be much appreciated.
The difference in both cases is the path "/docs/reference/java/" and "/src/reference/android/os/"
Please have a look at this url:
How to generate links to the android Classes' reference in javadoc?
It may guide you to correction.
Solved: I think it's just a plain Eclipse bug.
When I hover over the (overriden) onCreate the popup's header shows it belonging to my package and activity which extends Activity (as it must do)
If I click on the link inside the popup : Overrides: onCreate(...) in Activity
The the popup changes to show the same information but in class:
void android.app.Activity.onCreate(Bundle savedInstanceState)
Then, if I click on 'Bundle' in the new popup, all is well, we get the javadocs.
It's almost as if Eclipse thinks that the class Bundle itself has been overriden too and looks for the javadocs in my source.
Related
I am new to app development and have come across an issue my course hasn't yet covered but requires.
I have created a simple app that generates a log entry using Log.i after clicking a button - see screenshot below.
link to screenshot
As you may well see, no logs have been generated at all for the running emulator. This happened on an earlier app and after searching for an answer, found that going to the terminal and finding the appropriate directory, I could restart the adb using the 'kill-server' and 'start-server' commands. As this didn't work, I found the file in windows explorer and double clicked the adb.exe file. This seemed to fix the problem.
Having started another project (the one linked in the screenshot), the same problem has arisen but the same steps do not correct the issue and as such have nothing being generated in the logcat.
*beneath the emulator you see, I have nothing in the search box, the logcat is set to verbose and regex(?) is ticked.
Any help with this would be greatly appreciated as i'm reluctant to proceed with the course material before sorting out this issue.
Thanks.
some additional information I have found in the 'AVD' section of the 'Run' Window :
libpng warnings
adb successful start?
EDIT - requested code
EDIT 2 - It's a bit of a bodge but it seems the adb operator command 'logcat' used in the Terminal, turns the terminal into the logcat i.e. c:..\sdk\adb logcat' - all my missing logs, including the ones generated by the buttonClicked function appear in the terminal and new logs also appear there.
Terminal as logcat
Thank you for your responses but maybe someone knows a way to fix the logcat itself, i'd appreciate the answer. Thanks again.
I have managed to resolve the issue by closing all related software, rebooting my laptop and running the adb.exe file in the ..\android\sdk\platform-tools\ directory before launching the android studio.
Hope this helps if anyone else has the same issue.
Stitches S, I think you are not calling the buttonclicked method anywhere as I haven't seen it calling in the screenshot. But if you are calling it somewhere else then try log.d() to print that. It always works for me.
if you want to see log on button click set the buttonClick method inside the oncreate(), may be its doing nothing that's why not showing any log
this code is working in my case:
public class About_us extends AppCompatActivity {
TextView header, address;
private String Info="Info";
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contact);
header=findViewById(R.id.head);
address= findViewById(R.id.tv_address);
}
public void buttonClick(View view){
Log.d( Info,"button is clickd" );
}
}
and this is my xml view
<TextView android:id="#+id/head"
android:onClick="buttonClick"
android:layout_width="match_parent"
android:background="#color/third"
android:text="#string/app_name"
android:gravity="center"
android:textSize="20sp"
android:textColor="#color/first"
android:layout_height="30dp"/>
Inside Google analytics admin section I created 4 custom dimension. 1st dimension scope is "user", 2nd, 3rd and 4th dimension's scope is "hit".
I set parameters inside my onCreate function and send them in onStart command of my Activity. But when I check custom reports, I see that 1st dimension is set correctly. But no data for other 3 dimensions. I tried different days and waited but no change. I can see 1st dimension's data successfully. How can I set these custom dimensions, what do I miss ?
#Override
public void onCreate(Bundle savedInstanceState) {
MyUtil.initializeGAtracker(mContext);
MyUtil.getGaTracker().set(Fields.customDimension(1), "aaa");
MyUtil.getGaTracker().set(Fields.customDimension(2), "bbb");
MyUtil.getGaTracker().set(Fields.customDimension(3), "ccc");
MyUtil.getGaTracker().set(Fields.customDimension(4), "ddd");
MyUtil.getGaTracker().set(Fields.SCREEN_NAME, "myscreen");
}
#Override
public void onStart() {
super.onStart();
MyUtil.getGaTracker().send(MapBuilder.createAppView().build());
}
I also tried this. But it didn't help:
MyUtil.getGaTracker().send(MapBuilder
.createAppView()
.set(Fields.customDimension(2), "bbb")
.set(Fields.customDimension(3), "ccc")
.set(Fields.customDimension(4), "ddd")
.build()
);
Is there a detailed resource for setting multiple custom dimensions ?
I only found this:
https://developers.google.com/analytics/devguides/collection/android/v3/customdimsmets
Edit: Documentation is not adequate, also custom dimensions documentation has syntax error.
The code that you provided should work correctly.
Can you provide more details on MyUtil class?
Do you see any errors in debug mode? The SDK should output a bunch of errors if there is something wrong.
The SDK also prints out the hits that it is sending over wire. Can you copy and paste one of such hits here?
Also, your code snippets do not show you setting the tracking id. Can you check that you have set the ID? You can set it in the xml config or in the SDK APIs.
Peace be on all of you!
I have to develop a questionnaire like small android app. There will be 10 questions with only 2 types of answers, i.e. either "Yes" or "No". When the user will answer all of the 10 questions, a report will be shown to user according to his answers.
Kindly tell me, how should I proceed? Do I need to use database (sqlite) or can work without it? and how should I start to develop this app?
I am new to Android.
Thank-you!
If you are new to Android, than use a web approach: Show a html page 1-10 in a webView and link it each other and finally the 10th is linked to an url, where you will do a http POST / GET with your collected 10 params. Exactly as how would you do in a "standard' web development. Also you can use several app to wrapp into Android app: Appcelerator, Phonegap and so on.
Here is a class which is a screen: (Android Activity)
public class Help extends Activity{
private WebView webViewHelp;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
webViewHelp = (WebView) findViewById(R.id.webViewHelp);
webViewHelp.loadUrl("file:///android_asset/ui/help.html");
}
}
you need the help.xml build and placed into /res/layout/ folder.
Also write the help.html and place it into: /assets/ui folder and not android_asset and at is not file:///assets/ui/help.html!
in this case you have the starting point set up, than go and load with html links the next next next ... until is done, than pust url.
Somewhat easyer if you are doing in android ui development, and not web-like, but that need a bit more experience
I'm trying to use PhoneGap with Android. In the Sample that I run the main app opens an html file:
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
Now if I change something in the html page, Android always shows the previous content.
Is it possible that the output files (resources in that case) are not updated?
Also if I change the name of the html file in /assets/newName.html and into .loadUrl nothing changes.
Thank you, F.
I'm determined to find a proper answer to this, at the moment changes in the assets dir do not trigger a rebuild.
At the moment I'm slapping a new line in the Activity.java code to force a rebild/deploy..
Will update once I've looked for a real solution.
I see this sometimes when I add a data file to a project in eclipse.
If you think you pkg isnt being updated (re-built) then just rebuild it manually. If your using eclipse just do project->clean and select the project you want to clean. it'll rebuild automatically and include anything that was missed out.
OK Guys found.
The tutorial in the wiki.phonegap.com is obsolete.
Samples instead are updated!
Many thanks.
First off, as background: I am on a Mac, running OS X 10.6.7. Using Eclipse for an Android Development class I'm in (and hopefully eventually to actually develop directly for Android).
I had a nasty crash of Eclipse a few days ago, and after restarting I stopped getting any output from LogCat whatsoever. I tried everything I could think of, and I couldn't get anything at all to show up in the log. I tried a nuke-it-from-orbit reinstall of Eclipse, and it's at least made a little bit of a difference. When I run this code snippet I came up with to test things:
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class LogTester extends Activity {
/** Called when the activity is first created. */
public static final String TAG = "LogTester";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(TAG, "Activity was created");
Log.d(TAG, "Anybody Home?");
}
}
...it shows me this (apparently I can't post images directly as a noob), but when I actually click on the LogTester tab of LogCat, I see nothing. The same thing vice-versa when I click back over to the main log tab, which as you can see should have 11 new items in it.
I tried changing the font since maybe there was some sort of issue with displaying the font, and I've heard there are weird issues with fonts and 10.6.7. But I get a "Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench"." error and a complete refusal to change the font type. I can't figure out where Eclipse hides this preference so I can try and fiddle with it manually.
Anyone have any ideas/suggestions as to things I should try next? This is absolutely maddening. Thanks!
UPDATE (3/31 1am): I deleted and recreated my AVM for about the 15th time and LogCat suddenly started working. Hell if I know why, but I'm not questioning it.
try switching to DDMS perspective and click on your active emulator in the Device tab. Your Logcat should refresh then.
I know this post is old but a filter got turned on for some reason using Firebase which really confused me for a few mintues while I tried to figure out what was going on.
Here's where you change the filter (in the android monitor panel):