i wrote code witch can to open pdf file in sdcard.but My question is there any possiblities to view Pdf files in own Layout using Xml files not static into Java files this is a my code
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
File pdfFile = new File(Environment
.getExternalStorageDirectory(), "test.pdf");
try {
if (pdfFile.exists()) {
Uri path = Uri.fromFile(pdfFile);
Intent objIntent = new Intent(Intent.ACTION_VIEW);
objIntent.setDataAndType(path, "application/pdf");
objIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(objIntent);
} else {
Toast.makeText(MainActivity.this, "File NotFound",
Toast.LENGTH_SHORT).show();
}
} catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this,
"No Viewer Application Found", Toast.LENGTH_SHORT)
.show();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
and also i have second question 2) when i run project on my device i have like this screen (
) when i click menu button on my device then i can to show setting menu
it is a possible to create my own menu.for example i want to create my button witch can to zoom same as a static menu's zoom button
thanks