I have developed simple image app that is suppose to swipe the images from left to right .After reading this link http://developer.android.com/training/sharing/shareaction.html#set-share-intent . I implemented the codes in my mainActivity.java. This code is suppose to show sharing option at the top along the actionbar. However, I am getting little yellow lamp near this code ..private void setShareIntent(Intent shareIntent) {...What does it mean.. Following is my mainActivity.java code..
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ShareActionProvider;
public class MainActivity extends Activity {
MediaPlayer oursong;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
oursong = MediaPlayer.create(MainActivity.this, R.raw.a);
oursong.start ();
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
ImageAdapter adapter = new ImageAdapter(this);
viewPager.setAdapter(adapter);
}
private ShareActionProvider mShareActionProvider;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate menu resource file.
getMenuInflater().inflate(R.menu.activity_main, menu);
// Locate MenuItem with ShareActionProvider
MenuItem item = menu.findItem(R.id.menu_item_share);
// Fetch and store ShareActionProvider
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
// Return true to display menu
return true;
}
@Override
protected void onPause(){
super.onPause();
oursong.release();
}
}
Error problems
Description Resource Path Location Type
[Accessibility] Missing contentDescription attribute on image fullimage.xml /Grid View/res/layout line 6 Android Lint Problem
Description Resource Path Location Type
<uses-sdk> tag should specify a target API level (the highest verified version; when running on later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?" AndroidManifest.xml /Copy of galleryDemo line 7 Android Lint Problem
Description Resource Path Location Type
Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details. AndroidManifest.xml /DailySounds line 8 Android Lint Problem
Description Resource Path Location Type
Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data) AndroidManifest.xml /Copy of galleryDemo line 10 Android Lint Problem
Description Resource Path Location Type
The value of the field MainActivity.mShareActionProvider is not used MainActivity.java /Copy of ViewpagerImageGallery/src/com/manishkpr/viewpagerimagegallery line 29 Java Problem
Description Resource Path Location Type
This method has a constructor name MainActivity.java /SecondActivityApp/src/com/secondactivityapp line 28 Java Problem
Description Resource Path Location Type
Use a layout_height of 0dp instead of wrap_content for better performance fullimage.xml /Grid View/res/layout line 9 Android Lint Problem
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manishkpr.viewpagerimagegallery"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.manishkpr.viewpagerimagegallery.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
If there is only a "yellow lamp" icon beside that line, then it's just a warning. Your program will run smoothly regardless, but it simply states that the intent is not used anywhere in your program (it's placed there unnecessarily) so you should try removing that line. If your program still runs smoothly, you are done.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.